To use a causal cluster, you will need to change:
1) URL connection: replace bolt://localhost:7687 with bolt+routing://localhost:7687
This will allow your application to make some LB request in the cluster and be fault tolerant without doing anything else.
2) When you open a new session, you must indicate what you will do in this session, i.e. READ OR WRITE. This will help the driver choose a good server (for example, a kernel or replica server). Otherwise, it is assumed that you will do several WRITE operations, and the driver will always select the main server ...
3), because you will be in the env. Cluster, there is some lag (some seconds) for the distribution of updates within the cluster. Or sometimes you need to read your own writes in two sessions. Here you will need bookmark functions.
The documentation is here: https://neo4j.com/docs/developer-manual/current/drivers/
Greetings.
logisima
source share