1

I am using gremlin console to interact with an Azure Cosmos database as explained in this Microsoft quickstart tutorial. However I am behind a corporate proxy and the command :remote connect tinkerpop.server conf/remote-secure.yaml fails with connection refused.

Here is the remote-secure.yaml file :

hosts: [xxxxxx.gremlin.cosmos.azure.com]
port: 443
username: /dbs/graph-test/colls/pk1
password: xyz
connectionPool: {
  enableSsl: true
}
serializer: {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, config: { serializeResultToString: true } }

I tried setting the environement variables just before calling the gremlin console in gremlin.bat :

set HTTPS_PROXY=http://username:password@proxy-adress:3128
set HTTP_PROXY=http://username:password@proxy-adress:3128

:: Launch the application

java %JAVA_OPTIONS% %JAVA_ARGS% -cp "%LIBDIR%\*;%EXTDIR%;" org.apache.tinkerpop.gremlin.console.Console %*

Same result - connection refused :

gremlin> :remote connect tinkerpop.server conf/remote-secure.yaml
12:10:45.142 [main] DEBUG org.apache.tinkerpop.gremlin.driver.Client - Initializing client on cluster [xxxxxx.gremlin.cosmos.azure.com/99.99.99.99:443]
12:10:47.304 [gremlin-driver-host-scheduler-1] INFO org.apache.tinkerpop.gremlin.driver.ConnectionPool - Signalled closing of connection pool on Host{address=xxxxxx.gremlin.cosmos.azure.com/99.99.99.99:443, hostUri=wss://xxxxxx.gremlin.cosmos.azure.com:443/gremlin} with core size of 2
12:10:47.304 [gremlin-driver-host-scheduler-1] ERROR org.apache.tinkerpop.gremlin.driver.Client - Could not initialize client for Host{address=xxxxxx.gremlin.cosmos.azure.com/99.99.99.99:443, hostUri=wss://xxxxxx.gremlin.cosmos.azure.com:443/gremlin}
12:10:47.304 [main] ERROR org.apache.tinkerpop.gremlin.driver.Client - Initialization failed
java.util.concurrent.CompletionException: Could not initialize 2 (minPoolSize) connections in pool. Successful connections=0. Closing the connection pool.
        at org.apache.tinkerpop.gremlin.driver.ConnectionPool.<init>(ConnectionPool.java:164)
        at org.apache.tinkerpop.gremlin.driver.ConnectionPool.<init>(ConnectionPool.java:103)
        at org.apache.tinkerpop.gremlin.driver.ConnectionPool.<init>(ConnectionPool.java:98)
        at org.apache.tinkerpop.gremlin.driver.Client$ClusteredClient.lambda$new$5(Client.java:584)
        at org.apache.tinkerpop.gremlin.driver.Client$ClusteredClient.lambda$initializeImplementation$0(Client.java:534)
        at java.util.concurrent.CompletableFuture$AsyncRun.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.tinkerpop.gremlin.driver.exception.ConnectionException: Could not open Connection{channel=null host=Host{address=xxxxxx.gremlin.cosmos.azure.com/99.99.99.99:443, hostUri=wss://xxxxxx.gremlin.cosmos.azure.com:443/gremlin} isDead=false borrowed=0 pending=0 markedReplaced=false closing=false created=2023-04-27T16:10:45.142Z thread=gremlin-driver-conn-scheduler-1}
        at org.apache.tinkerpop.gremlin.driver.Connection.<init>(Connection.java:142)
        at org.apache.tinkerpop.gremlin.driver.ConnectionFactory.create(ConnectionFactory.java:34)
        at org.apache.tinkerpop.gremlin.driver.ConnectionPool.lambda$new$0(ConnectionPool.java:130)
        ... 8 common frames omitted
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: xxxxxx.gremlin.cosmos.azure.com/99.99.99.99:443

I was able to make the gremlin console successfully connect to the database by using the Azure Cloud shell which is not behind a proxy using the exact same steps of the quickstart tutorial.

I suspect I should be able to specify http proxy setting like proxy host, port, username and password in the remote-secure.yaml file however I cannot find any documentation or examples.

How and where can I setup my proxy settings ?

Any information would be appreciated

Regards,

Added the proxy info in the java command line, same outcome :

set JAVA_OPTIONS=-Xms32m -Xmx512m -Djline.terminal=none -Dhttp.proxyHost=http://user:pass@proxy-address -Dhttp.proxyPort=3128

:: Launch the application

java %JAVA_OPTIONS% %JAVA_ARGS% -cp "%LIBDIR%\*;%EXTDIR%;" org.apache.tinkerpop.gremlin.console.Console %*
Francois
  • 11
  • 3

1 Answers1

0

The java docs suggest to set a few java system properties for the http and https protocols in your java command: https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html

You can check whether your proxy server works as expected using: https://websocketstest.com/

HadoopMarc
  • 1,356
  • 3
  • 11
  • Good suggestion, however adding -Dhttp.proxyHost and -Dhttp.proxyHost gave me the same error. I tried with -Dhttps.proxyHost and -Dhttps.proxyHost too, same outcome. I added this to my original post – Francois Apr 28 '23 at 11:52