Moses
Moses

Reputation: 113

Gremlin Python - Connection to Multi-Node JanusGraph Cluster

We looking to build a multi node JanusGraph cluster

10.74.19.32 (e.g. IP)

10.74.19.33 (e.g. IP)

Our application is written in python and uses the gremlin python driver

session = client.Client('ws://10.74.19.32:8182/gremlin', 'g',
message_serializer=GraphSONSerializersV3d0(), 
username=remote_graph_user, 
password=remote_graph_password, pool_size=8)

we could not find examples of how to connect round robin between the two JanusGraph servers 10.74.19.32 & 10.74.19.33

Should we put this through a load balancer url and once the connection is opened, python app stays with the same server until connection is closed or interrupted?

should we do

session = client.Client('ws://vanity_url:8182/gremlin', 'g',
    message_serializer=GraphSONSerializersV3d0(), 
    username=remote_graph_user, 
    password=remote_graph_password, pool_size=8)

Upvotes: 1

Views: 641

Answers (2)

Murthy Remella
Murthy Remella

Reputation: 9

I am using org.apache.tinkerpop.gremlin.driver.cluster in Java language, which allows me to connect to two janus (gremlin) servers without load balancer

Hope this helps!

GryoMapper.Builder mapBuilder = GryoMapper.build().addRegistry(JanusGraphIoRegistry.getInstance());
Cluster cluster = Cluster.build().serializer(new GryoMessageSerializerV1d0(mapBuilder)).addContactPoints(url, url2).port(Integer.parseInt(port)).create();
Client client = cluster.connect();
Graph graph = EmptyGraph.instance();
g=graph.traversal().withRemote(DriverRemoteConnection.using(client.getCluster()));

Upvotes: -1

Chris Hupman
Chris Hupman

Reputation: 408

You're already on the right track. You'll want to setup a loadbalancer in front of the gremlin servers. This isn't something that gremlin-server will handle.

Upvotes: 3

Related Questions