Custom gremlin server installation to connect to remote Cassandra ?

358 views
Skip to first unread message

bhuvanrk

unread,
Aug 24, 2016, 3:14:25 PM8/24/16
to Aurelius
Hi, 


and I'm able to connect to a local Cassandra node from the gremlin shell and issue groovy commands. 

gremlin> graph = TinkerGraph.open();

==>tinkergraph[vertices:0 edges:0]

gremlin> marko = graph.addVertex(T.label, "person", T.id, 1, "name", "marko", "age", 29);

==>v[1]

gremlin> g = TinkerFactory.createModern().traversal(standard())

==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]

gremlin> g.V()

==>v[1]

==>v[2]

==>v[3]

==>v[4]

==>v[5]

==>v[6]

gremlin> g.V().values('name')

==>marko

==>vadas

==>lop

==>josh

==>ripple

==>peter

gremlin> g.V().has('name','marko').out('knows').values('name')

==>vadas

==>josh


Now, how do I change this set-up to work for a remote Cassandra instance ? I have tried the following : 

1. Spawning gremlin-server with a yaml file (and internally properties file) mentioning the remote host/port instead of localhost. I get this error : Cannot assign requested address

$ bin/gremlin-server.sh /home/appsec/gremlin-server-3.0.0.M6/conf/remote-gremlin-server.yaml

[INFO] GremlinServer - 

         \,,,/

         (o o)

-----oOOo-(3)-oOOo-----


[INFO] GremlinServer - Configuring Gremlin Server from /home/appsec/gremlin-server-3.0.0.M6/conf/remote-gremlin-server.yaml

[INFO] MetricManager - Configured Metrics ConsoleReporter configured with report interval=180000ms

[INFO] MetricManager - Configured Metrics CsvReporter configured with report interval=180000ms to fileName=/tmp/gremlin-server-metrics.csv

[INFO] MetricManager - Configured Metrics JmxReporter configured with domain= and agentId=

[INFO] MetricManager - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=com.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics

[WARN] Graphs - Graph [g] configured at [conf/remote-titan-cassandra.properties] could not be instantiated and will not be available in Gremlin Server.  GraphFactory message: GraphFactory could not instantiate this Graph implementation [com.thinkaurelius.titan.core.TitanFactory]

java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [com.thinkaurelius.titan.core.TitanFactory]

:

:

[ERROR] GremlinServer - Gremlin Server Error

java.net.BindException: Cannot assign requested address

at sun.nio.ch.Net.bind0(Native Method)

at sun.nio.ch.Net.bind(Net.java:433)

at sun.nio.ch.Net.bind(Net.java:425)

at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)

at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)

at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:125)

at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:475)

at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1021)

at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:455)

at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:440)

at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:844)

at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:194)

at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:340)

at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380)

at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)

at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)

at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)

at java.lang.Thread.run(Thread.java:745)

[INFO] GremlinServer - Shutting down thread pools

[INFO] GremlinServer - Gremlin Server - shutdown complete


2. Directly using the gremlin shell to connect to a remote Cassandra server (This command basically hangs) : 


gremlin> :remote connect tinkerpop.server /home/appsec/titan-1.0.0-hadoop1/conf/remote-cassandra-settings.yaml


Notice that this bypasses the Titan package (except for borrowing the yaml and properties files).  Is this even possible ? or is this possible only via the Titan package route ?

Thanks

Jason Plurad

unread,
Aug 24, 2016, 9:21:13 PM8/24/16
to Aurelius
Any particular reason you're trying to use Titan 0.9.0-M1 with Gremlin 3.0.0-M6? That was released in December 2014, and it was just a milestone release.

Titan 1.0.0 was released in September 2015, almost a year ago.

-- Jason

bhuvanrk

unread,
Aug 25, 2016, 1:59:51 PM8/25/16
to Aurelius
Hi Jason, 

No particular reason. I can try an upgrade, but my question still remains. Can I use gremlin-server outside of the Titan package to directly connect with a remote Cassandra cluster ? Then I can use the gremlin-shell to directly traverse a Cassandra backend as a graph ? I dont need ES or any other Titan related packages. 

Jason Plurad

unread,
Aug 25, 2016, 2:52:18 PM8/25/16
to Aurelius
If you can move to 1.0.0, you would be more likely to get help from more people out here in the community. I'd think that most folks are either using 0.5.4, 1.0.0, or building the latest source code on the titan11 branch.

Yes, you could grab gremlin-server from Apache TinkerPop and get it to work with Titan. You still would have to import the Titan libraries as a Gremlin Server plugin.

# Get Apache TinkerPop's Gremlin Server (Titan 1.0.0 uses TinkerPop 3.0.1)
unzip apache
-gremlin-server-3.0.1-incubating-bin.zip
cd apache
-gremlin-server-3.0.1-incubating

# This will install Titan-Cassandra as a plugin under ext/titan-cassandra
./bin/gremlin-server.sh -i com.thinkaurelius.titan titan-cassandra 1.0.0

# Copy over some Titan configuration files
# https://gist.github.com/pluradj/8437255e831d2b640b6fea4f815a79c5
# * conf/titan-server.yaml
# * conf/titan-cassandra.properties

# start the server with Titan configuration
./bin/gremlin-server.sh conf/titan-server.yaml



-- Jason
Reply all
Reply to author
Forward
0 new messages