0

我通过这个helm chart在 K8s 中部署了一个 3 核(默认情况下)Neo4j 。我是neo4j的新手。

我在 Ruby on Rails 项目中使用neo4jrb 。

当我尝试连接 neo4j 服务写入数据时。我经常(并非总是)遇到这个错误

Neo4j::Core::CypherSession::CypherError:   Cypher error:
  Neo.ClientError.Cluster.NotALeader: No write operations are allowed directly on this database. Writes must pass through the leader. The role of this server is: FOLLOWER

我阅读了这篇文章Querying Neo4j Clusters。然后我意识到舵图创建了一个领导者和两个追随者核心。在密码外壳中,当我运行时

CALL dbms.cluster.overview() YIELD id, role RETURN id, role

我有

+-----------------------------------------------------+
| id                                     | role       |
+-----------------------------------------------------+
| "acce2b2c-53ae-498c-a49b-84f42897445e" | "FOLLOWER" |
| "03cabb09-de1a-40cc-b8b0-bb02981cf551" | "FOLLOWER" |
| "1aa96add-f5cd-43a1-9fc6-2a5360668bb7" | "LEADER"   |
+-----------------------------------------------------+

LEADER因此,当我尝试写入数据时,我应该连接到。而且我知道集群不能leader永久存在。如果电流leader下降,那么follower将成为一个新的leader

我曾经认为bolt+routing因果集群可能是解决我的问题的简单方法。当我回到 ruby​​ 客户端时,我发现它bolt+routing现在不支持。

我现在该怎么办?我无法配置 LoadBalancer。我有权为 Ingress 编写配置。

4

1 回答 1

0

我不确定 neo4jrb 是否支持螺栓+路由。

您可以尝试使用 graalvm 的 truffleruby 中的 java 驱动程序,请参阅:

https://github.com/michael-simons/neo4j-graalvm-polyglot-examples

于 2020-05-13T23:09:41.800 回答