Causal Cluster Implementation

I am creating an application that uses the neo4j native JavaScript driver. I want to make sure that my code will work if we move on to the causal cluster.

The online documentation does not seem to be clear how to do this: I notice rare links to things like “bookmarks” and “reading what you wrote,” etc. But how it all fits together is unclear.

Can someone provide an overview?

+8
neo4j neo4j-bolt
source share
1 answer

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.

+5
source share

All Articles