Installing Neo4j Cluster in Ubuntu 16 LTS

Today i’d been busy working on my cluster… its a 3 node running in Ubuntu.
this is a basic configuration of Neo4j cluster… on my next time let try anvance feature including backup and recovery.

First thing we need to check is the Java.

 
neo4j@lnxneo4j01:~$ java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
neo4j@lnxneo4j01:~$

neo4j@lnxneo4j02:~$ java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
neo4j@lnxneo4j02:~$

neo4j@lnxneo4j03:~$ java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
neo4j@lnxneo4j03:~$

Lets untar the installer in /opt. do the same for all nodes.

 
neo4j@lnxneo4j01:~$ sudo cp /mnt/hgfs/Downloads/neo4j-enterprise-3.0.6-unix.tar /opt/
neo4j@lnxneo4j01:~$

neo4j@lnxneo4j01:/opt$ sudo tar -xvf neo4j-enterprise-3.0.6-unix.tar 
neo4j@lnxneo4j01:/opt$ ls -lrt
total 69516
drwxr-xr-x 10 avahi-autoipd nogroup     4096 Sep 14 22:15 neo4j-enterprise-3.0.6
-rw-r--r--  1 root          root    71178240 Oct 30 21:59 neo4j-enterprise-3.0.6-unix.tar
neo4j@lnxneo4j01:/opt$

Without changing anything on the conf, try to start the neo4j, by default its standalone. Do the same for other nodes.

 
neo4j@lnxneo4j01:/opt/neo4j-enterprise-3.0.6/bin$ sudo ./neo4j console
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.
2016-10-30 14:03:14.376+0000 INFO  No SSL certificate found, generating a self-signed certificate..
2016-10-30 14:03:17.575+0000 INFO  Starting...
2016-10-30 14:03:19.272+0000 INFO  Bolt enabled on localhost:7687.
2016-10-30 14:03:19.322+0000 INFO  Initiating metrics...
2016-10-30 14:03:28.080+0000 INFO  Started.
2016-10-30 14:03:28.690+0000 INFO  Mounted REST API at: /db/manage
2016-10-30 14:03:32.631+0000 INFO  Remote interface available at http://localhost:7474/
^C2016-10-30 14:03:50.051+0000 INFO  Neo4j Server shutdown initiated by request
2016-10-30 14:03:50.148+0000 INFO  Stopping...
2016-10-30 14:03:50.309+0000 INFO  Stopped.
neo4j@lnxneo4j01:/opt/neo4j-enterprise-3.0.6/bin$

so far for me, for all three nodes i don’t see any issues. so lets continue. Do the same for all nodes.

 
neo4j@lnxneo4j01:/opt$ sudo ln -s /opt/neo4j-enterprise-3.0.6 /opt/neo4j-current
neo4j@lnxneo4j01:/opt$ ls -lrt
total 4
drwxr-xr-x 11 avahi-autoipd nogroup 4096 Oct 30 22:03 neo4j-enterprise-3.0.6
lrwxrwxrwx  1 root          root      27 Oct 30 22:05 neo4j-current -> /opt/neo4j-enterprise-3.0.6
neo4j@lnxneo4j01:/opt$

Now lets configure our cluster. the configuration is all same except for ha.server_id.
ha.server_id = 1 < ha.server_id = 2 < ha.server_id = 3 <

 
# To accept non-local HTTP connections, uncomment this line
dbms.connector.http.address=0.0.0.0:7474
# HA - High Availability
# SINGLE - Single mode, default.
dbms.mode=HA
# Unique server id for this Neo4j instance
# can not be negative id and must be unique
ha.server_id = 1

# ha.initial_hosts is a comma-separated list (without spaces) of the host:port
# where the ha.host.coordination of all instances will be listening. Typically
# this will be the same for all cluster instances.
ha.initial_hosts=lnxneo4j01:5001,lnxneo4j02:5001,lnxneo4j03:5001

Now lets start the all our nodes.

 
neo4j@lnxneo4j01:/opt/neo4j-current/bin$ sudo ./neo4j start
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.
Started neo4j (pid 12786). By default, it is available at http://localhost:7474/
This HA instance will be operational once it has joined the cluster.
See /opt/neo4j-enterprise-3.0.6/logs/neo4j.log for current status.
neo4j@lnxneo4j01:/opt/neo4j-current/bin$

neo4j@lnxneo4j02:/opt/neo4j-current/bin$ sudo ./neo4j start
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.
Started neo4j (pid 12786). By default, it is available at http://localhost:7474/
This HA instance will be operational once it has joined the cluster.
See /opt/neo4j-enterprise-3.0.6/logs/neo4j.log for current status.
neo4j@lnxneo4j02:/opt/neo4j-current/bin$

neo4j@lnxneo4j03:/opt/neo4j-current/bin$ sudo ./neo4j start
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.
Started neo4j (pid 12786). By default, it is available at http://localhost:7474/
This HA instance will be operational once it has joined the cluster.
See /opt/neo4j-enterprise-3.0.6/logs/neo4j.log for current status.
neo4j@lnxneo4j03:/opt/neo4j-current/bin$
screen-shot-2016-11-01-at-7-58-32-am
This is the default screen.. the login page.
screen-shot-2016-11-01-at-7-58-13-am
after logging…
screen-shot-2016-11-01-at-7-42-16-am
after clicking the Monitor, it will show the status of the cluster.
screen-shot-2016-11-01-at-7-37-32-am
i’ll try to stop the node and observe what happen to my console.
screen-shot-2016-11-01-at-7-37-56-am
Node 1 was remove from my cluster.
screen-shot-2016-11-01-at-7-38-31-am
We can see in the logs that Node1 left the cluster.
screen-shot-2016-11-01-at-7-41-40-am
Now lets start node 1 and see what happens
screen-shot-2016-11-01-at-7-42-00-am
Node 1 joined the cluster again
screen-shot-2016-11-01-at-7-42-16-am
see node1 is part of the cluster gain.
screen-shot-2016-11-01-at-7-36-53-am
Now if i stop and start my Node 2, Node 1 became the master.

On my next update i’ll try to explore more on the clustering feature of Neo4j. i’m new with this so dont expect to much.


					
Advertisements

One thought on “Installing Neo4j Cluster in Ubuntu 16 LTS

  1. Now lets configure our cluster. the configuration is all same except for ha.server_id.
    ha.server_id = 1 < ha.server_id = 2 < ha.server_id = 3 <..

    where to perform these operations?Which file we need to edit?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s