Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Pre-requisites

  • OpenJDK8
  • Zookeeper

Install OpenJDK

$ sudo apt-get install openjdk-8-jdk 

...

$ vim /home/zookeeper/zookeeper-3.4.13/conf/zoo.cfg


dataDir=/var/lib/zookeeper
server.1=node1:2888:3888
server.2=node2:2888:3888
server.3=node3:2888:3888


Now, do the below changes in log4.properties file as follows.

$ vim /home/zookeeper/zookeeper-3.4.13/conf/log4j.properties


zookeeper.log.dir=/var/log/zookeeper 
zookeeper.tracelog.dir=/var/log/zookeeper 
log4j.rootLogger=INFO, CONSOLE, ROLLINGFILE

...

In Zookeeper ensemble out of three servers, one will be in leader mode and other two will be in follower mode. You can check the status by running the following commands.

$ /home/zookeeper/zookeeper-3.4.13/bin/zkServer.sh status


Zookeeper Service Status Check.

Zookeeper Service Status Check.Image Added


$ echo stat | nc node1 2181


Lists brief details for the server and connected clients.

Lists brief details for the server and connected clientsImage Added


$ echo mntr | nc node1 2181


Zookeeper list of variables for cluster health monitoring.

Zookeeper list of variables for cluster health monitoringImage Added


$ echo srvr | nc localhost 2181


Lists full details for the Zookeeper server.

Lists full details for the Zookeeper server.Image Added


If you need to check and see the znode, you can connect by using the below command on any of the zookeeper node:

$ /home/zookeeper/zookeeper-3.4.13/bin/zkCli.sh -server `hostname -f`:2181

Connect to Zookeeper data node and lists the contents.

Connect to Zookeeper data node and lists the contents.Image Added