Gremlin Python - 连接到多节点 JanusGraph 集群

Gremlin Python - Connection to Multi-Node JanusGraph Cluster

我们希望构建一个多节点 JanusGraph 集群

10.74.19.32(如 IP)

10.74.19.33(例如 IP)

我们的应用程序是用 python 编写的,并使用 gremlin python 驱动程序

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)

我们找不到有关如何在两个 JanusGraph 服务器 10.74.19.32 和 10.74.19.33 之间连接循环的示例

我们是否应该通过负载平衡器将其放置 url 并且一旦打开连接,python 应用程序会一直使用同一台服务器直到连接关闭或中断?

我们应该怎么做

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

您已经在正确的轨道上了。您需要在 gremlin 服务器之前设置一个负载均衡器。这不是 gremlin-server 会处理的事情。

我正在使用 Java 语言的 org.apache.tinkerpop.gremlin.driver.cluster,这允许我在没有负载平衡器的情况下连接到两个 janus (gremlin) 服务器

希望对您有所帮助!

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()));