Connecting GremlinServer to remote Cassandra and ElasticSearch services

1,090 views
Skip to first unread message

Al Byers

unread,
Sep 19, 2018, 12:49:24 PM9/19/18
to JanusGraph users
I would like to get to the point that I can spin off multiple containers running my groovy code with embedded JanusGraph instances. To get there I first ran the standard OOTB janusgraph.sh from the 0.3.0 release on a separate server on my local network. I got it to run and could connect a gremlin-console from another machine on the local network.

Then I went to another machine outside my local network and modified the "conf/gremlin-server/janusgraph-cql-es-server.properties file with these two lines:
storage.hostname=xx.xx.xx.xx
index.search.hostname=xx.xx.xx.xx
with xx.xx.xx.xx pointing to the public address of my local network gateway.

Then I started the gremlin-server with:

 bin//gremlin-server.sh conf/gremlin-server/gremlin-server.yaml &>gremlin-start.log &

the gremlin-server.yaml file points to the janusgraph-cql-es.server.properties file and I get the error below:

 24 1385 [main] WARN  org.apache.tinkerpop.gremlin.server.GremlinServer  - Graph [graph] configured at [conf/gremlin-server/janusgraph-cql-es-server.properties] could not be instantiated an    d will not be available in Gremlin Server.  GraphFactory message: GraphFactory could not instantiate this Graph implementation [class org.janusgraph.core.JanusGraphFactory]
 25 java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [class org.janusgraph.core.JanusGraphFactory]
 26         at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:82)
 27         at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:70)
 28         at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:104)
 29         at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.lambda$new$0(DefaultGraphManager.java:57)
 30         at java.util.LinkedHashMap$LinkedEntrySet.forEach(LinkedHashMap.java:671)
 31         at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.<init>(DefaultGraphManager.java:55)
 32         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 33         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 34         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 35         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
 36         at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:80)
 37         at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:120)
 38         at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:84)
 39         at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:343)
 40 Caused by: java.lang.reflect.InvocationTargetException
 41         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 42         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 43         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 44         at java.lang.reflect.Method.invoke(Method.java:498)
 45         at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:78)
 46         ... 13 more
 47 Caused by: java.lang.IllegalArgumentException: Could not instantiate implementation: org.janusgraph.diskstorage.cql.CQLStoreManager
 48         at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:64)
 49         at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:476)
 50         at org.janusgraph.diskstorage.Backend.getStorageManager(Backend.java:408)
 51         at org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1254)
 52         at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:160)
 53         at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:131)
 54         at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:111)
 55         ... 18 more
 56 Caused by: java.lang.reflect.InvocationTargetException
 57         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 58         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 59         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 60         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
 61         at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:58)
 62         ... 24 more
 63 Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /67.163.64.9:9042 (com.datastax.driver.core.exceptions.TransportException: [/<xx.xx.xx.xx>:9042] Cannot connect))
 64         at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:232)
 65         at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79)
 66         at com.datastax.driver.core.Cluster$Manager.negotiateProtocolVersionAndConnect(Cluster.java:1600)
 67         at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1518)
 

So I am at the point of trying to debug "All host(s) tried for query failed (tried: /67.163.64.9:9042 (com.datastax.driver.core.exceptions.TransportException: [/<xx.xx.xx.xx>:9042] Cannot connect)" error. I have opened up xx.xx.xx.xx/9042 port on my router and my server machine. I test it with:

cat < /dev/tcp/xx.xx.xx.xx/9042 and get "Connection refused"

Am I still at a networking problem or am I going about the whole process incorrectly?

Regards
Al


Al Byers

unread,
Sep 19, 2018, 3:59:53 PM9/19/18
to JanusGraph users
Update: My public IP had rolled over and when I retried: "cat < /dev/tcp/xx.xx.xx.xx/9042" it came back with a "Connection timed out" message, so I gather it is not a networking issue.

Jason Plurad

unread,
Sep 19, 2018, 5:01:50 PM9/19/18
to JanusGraph users
If you are using the prepackaged distribution rather than separate Cassandra and Elasticsearch installs, be aware that it is intended for single node, localhost access only.

You'll need to become more familiar with some of configuration files for those backends. In particular, in the $JANUSGRAPH_HOME/conf/cassandra/cassandra.yaml you need to update listen_address: xx.xx.xx.xx. Similarly, in the $JANUSGRAPH_HOME/elasticsearch/config/elasticsearch.yml you need to add network.host: xx.xx.xx.xx

Also, if you are using the cql backend, port 9042 is sufficient. If you are using the Thrift-based cassandra or cassandrathrift, you need to make sure that Thrift is enabled and that 9160 port is open.

Al Byers

unread,
Sep 19, 2018, 5:39:40 PM9/19/18
to JanusGraph users
Thanks. I am seeing that this is good advice. Here is a link that talks about this - though I haven't found the one that applies. 


I guess I will have to do what you say and understand it rather than apply every patch that I see.

Al Byers

unread,
Sep 21, 2018, 10:59:54 AM9/21/18
to JanusGraph users
I am seeing comments saying that the client driver version must match the server side. What files should I be looking at? All the dse* files? I am using v1.7.0 and when I run "bin/cassandra -v" I get 2.1.20.

Why such an older version of Cassandra? This link talks about driver and server compatibility, but I don't understand the "DSE..." designation under the Cassandra version or the driver versions on the left.

Al Byers

unread,
Sep 21, 2018, 10:07:20 PM9/21/18
to JanusGraph users

Follow on question: 
I am trying to establish a baseline - someway to connect to connect to cassandra to test that it is alive and kicking and seemed like running cqlsh would be a good way, so I ran:

 cqlsh 192.168.1.197 9042 --cqlversion="3.1"
Connection error: ('Unable to connect to any servers', {'192.168.1.197': DriverException('ProtocolError returned from server while using explicitly set client protocol_version 4',)})

I determined that cqlversion was the correct one for Cassandra 2.1.20 (the one that comes with 0.3.0). I get the same error if I do not include any cqlversion.

Is there something missing that is keeping me from connecting?

Reply all
Reply to author
Forward
0 new messages