Matan Shidlov
Matan Shidlov

Reputation: 127

connecting to neo4j HA Cluster

What is the proper way for connecting neo4j HA cluster using neo4j-ogm and allowing high availability and reads scale-out?

I have seen few solutions that involves haproxy.

the first one is the neo4j ogm-manual that shows how to configure haproxy to transfer connections to the current master. this solution allowing high availability, but disallowing scale-out reads.

The second one is Stefan Armbruster blog "neo4j and haproxy: some best practices and tricks" about configuring haproxy for routing reads operations for the whole cluster and write operations only for the master server.

I have few problems with Stefan solution:

  1. I cannot use bolt protocol, I must use http driver.
  2. I'm going to use transactions for all of my queries, and I'm afraid it will cause issues because according to the neo4j developer manual:

    Open transactions are not shared among members of an HA cluster. Therefore, if you use this endpoint in an HA cluster, you must ensure that all requests for a given transaction are sent to the same Neo4j instance.

Upvotes: 0

Views: 319

Answers (1)

Luanne
Luanne

Reputation: 19373

At the moment, Neo4j OGM does not distinguish between reads and writes and hence is unable to decide whether to send a read request to a slave for example. This feature is on the roadmap, but for now, the safest is to direct all transactions to master.

Upvotes: 0

Related Questions