Neo4j Causal Cluster Demo

Demo – Neo4j Casual Clustering

  • Create a local working directory.
  • Download a copy of Neo4j Enterprise Edition from the Neo4j download site. Unpack Neo4j in the working directory.
  • Make a copy of the neo4j-enterprise-3.5.14 directory, and name it core-01. We will need to keep the original directory to use when setting up the Read Replicas later
  • The core-01 directory will contain the first Core instance

Configure the first Core instance

 
  . All configuration that we will do takes place in the Neo4j configuration file, conf/neo4j.conf. 
  . The first settings we will change represent the minimum configuration for a Core instance:
  . Locate and uncomment the setting 
       dbms.mode=CORE. 
  . Locate and uncomment the setting causal_clustering.minimum_core_cluster_size_at_formation=3.
  . Locate and uncomment the setting causal_clustering.minimum_core_cluster_size_at_runtime=3.
  . Locate and uncomment the setting causal_clustering.initial_discovery_members=localhost:5000,localhost:5001,localhost:5002.
  . Locate and uncomment the setting causal_clustering.discovery_listen_address=:5000. 
  . Locate and uncomment the setting causal_clustering.transaction_listen_address=:6000. 
  . Locate and uncomment the setting causal_clustering.raft_listen_address=:7000. 
  . Locate and uncomment the setting dbms.connector.bolt.listen_address=:7687. 
  . Locate and uncomment the setting dbms.connector.http.listen_address=:7474. 
  . Locate the dbms.connector.https.listen_address setting and change the value to :6474. 
  . Locate the dbms.backup.address setting and change the value to :6362. 
    dbms.backup.listen_address=0.0.0.0:6362

Configure the second Core instance

 
  . Make a copy of the core-01 directory and rename it core-02. 
  . Open the neo4j.conf file in the new core-02 directory. 
  . Locate the causal_clustering.discovery_listen_address setting and change the value to :5001. 
  . Locate the causal_clustering.transaction_listen_address setting and change the value to :6001. 
  . Locate the causal_clustering.raft_listen_address setting and change the value to :7001. 
  . Locate the dbms.connector.bolt.listen_address setting and change the value to :7688. 
  . Locate the dbms.connector.http.listen_address setting and change the value to :7475. 
  . Locate the dbms.connector.https.listen_address setting and change the value to :6475. 
  . Locate the dbms.backup.address setting and change the value to :6363. 
    dbms.backup.listen_address=0.0.0.0:6363

Configure the third Core instance

 
  . Make a copy of the core-02 directory and rename it core-03. 
  . Open the neo4j.conf file in the new core-03 directory. 
  . Locate the causal_clustering.discovery_listen_address setting and change the value to :5002. 
  . Locate the causal_clustering.transaction_listen_address setting and change the value to :6002. 
  . Locate the causal_clustering.raft_listen_address setting and change the value to :7002. 
  . Locate the dbms.connector.bolt.listen_address setting and change the value to :7689. 
  . Locate the dbms.connector.http.listen_address setting and change the value to :7476. 
  . Locate the dbms.connector.https.listen_address setting and change the value to :6476. 
  . Locate the dbms.backup.address setting and change the value to :6364. 
    dbms.backup.listen_address=0.0.0.0:6364

Start the Neo4j Servers

 
Neo4j console 

Core 1 Instance Starting Screen Shot

core1 starting image

Core 2 Instance Starting Screen Shot

core2 starting image

Core 3 Instance Starting Screen Shot

core3 starting image

Checking Sysinfo Screen Shot

checking sysinfo image

Cluster Overview Screen Shot

 
  command is call dbms.cluster.overview()
cluster overview image

Connecting to Core 2 instance Screen Shot

connecting to core2 instance image

Connecting to Core 3 instance Screen Shot

connecting to core3 instance image

Writing Data to Leader instance Screen Shot

writing data to leader instance image

Reading Data from Leader instance Screen Shot

reading data from leader instance image

Reading Data from Follower instance Screen Shot

connecting to core3 instance image

Writing Data to Follower instance Screen Shot

writing data to follower instance image

Configure Three Replicas

Configuring Replica 1

 
. In your working directory, make a copy of the neo4j-enterprise-3.5.14 directory and name it replica-01. 
. Open the neo4j.conf file in the new replica-01 directory. The first settings we will change represent the minimum configuration for a Read Replica: 
. Locate and uncomment the dbms.mode setting and change the value to READ_REPLICA. 
. Locate and uncomment the setting causal_clustering.initial_discovery_members=localhost:5000,localhost:5001,localhost:5002. 
Since we are setting up the Causal Cluster to run on a single machine, we must do some additional configuration. Please note that the following steps would not be necessary if the instances are running on different servers: 
. Locate and uncomment the causal_clustering.transaction_listen_address setting and change the value to :6003. 
. Locate and uncomment the dbms.connector.bolt.listen_address setting and change the value to :7690. 
. Locate and uncomment the dbms.connector.http.listen_address setting and change the value to :7477. 
. Locate and uncomment the dbms.connector.https.listen_address setting and change the value to :6477. 
. Locate and uncomment the dbms.backup.address setting and change the value to :6365. 

Configuring Replica 2

 
  . Make a copy of the replica-01 directory and rename it replica-02. 
  . Open the neo4j.conf file in the new replica-02 directory. 
  . Locate the causal_clustering.transaction_listen_address setting and change the value to :6004. 
  . Locate the dbms.connector.bolt.listen_address setting and change the value to :7691. 
  . Locate the dbms.connector.http.listen_address setting and change the value to :7478. 
  . Locate the dbms.connector.https.listen_address setting and change the value to :6478. 
  . Locate the dbms.backup.address setting and change the value to :6366. 

Configuring Replica 3

 
. Make a copy of the replica-02 directory and rename it replica-03. 
. Open the neo4j.conf file in the new replica-03 directory. 
. Locate the causal_clustering.transaction_listen_address setting and change the value to :6005. 
. Locate the dbms.connector.bolt.listen_address setting and change the value to :7692. 
. Locate the dbms.connector.http.listen_address setting and change the value to :7479. 
. Locate the dbms.connector.https.listen_address setting and change the value to :6479. 
. Locate the dbms.backup.address setting and change the value to :6367. 

Starting the replicas

 
replica-01\neo4j-enterprise-3.5.14\bin> neo4j console
replica-02\neo4j-enterprise-3.5.14\bin> neo4j console
replica-03\neo4j-enterprise-3.5.14\bin> neo4j console

Replica 1 start up Screen Shot

replica1 start up image

Replica 2 start up Screen Shot

replica2 start up image

Replica 3 start up Screen Shot

replica3 start up image

Checking data in replica Screen Shot

Checking data in replica image

Final Cluster View Image

Final Cluster View image

Killing the Leader Image

Killing the leader instance image

New leader elected Image

New leader elected Image

Writing to the new Leader Image

Writing to the new leader image

Replica Updated Image

Replica Updated image