Today we are going to create a zookeeper cluster with 5 instances.
1) Required / Installed software
1.a) Java - jdk1.7.* (/usr/java)
1.b) Zookeeper – zookeeper-3.4.6 (/opt/install/zookeeper)
1.c) Port selection for zookeeper deployment
1.c.i ) On Different Servers
1.c.ii ) On Same Servers
Sample Output
1) Required / Installed software
1.a) Java - jdk1.7.* (/usr/java)
1.b) Zookeeper – zookeeper-3.4.6 (/opt/install/zookeeper)
1.c) Port selection for zookeeper deployment
1.c.i ) On Different Servers
Server ID
|
Server IP
|
Client Port
|
Quorum Port
|
Leader Election Port
|
1
|
10.10.10.1
|
2181
|
2888
|
3888
|
2
|
10.10.10.2
|
2181
|
2888
|
3888
|
3
|
10.10.10.3
|
2181
|
2888
|
3888
|
4
|
10.10.10.4
|
2181
|
2888
|
3888
|
5
|
10.10.10.5
|
2181
|
2888
|
3888
|
1.c.ii ) On Same Servers
Server ID
|
Server IP
|
Client Port
|
Quorum Port
|
Leader Election Port
|
1
|
10.10.10.1
|
2181
|
2888
|
3888
|
2
|
10.10.10.1
|
2182
|
2889
|
3889
|
3
|
10.10.10.1
|
2183
|
2890
|
3890
|
4
|
10.10.10.1
|
2184
|
2891
|
3891
|
5
|
10.10.10.1
|
2185
|
2892
|
3892
|
2.a) Zookeeper Server
/opt/install/zookeeper/zookeeper1/
/opt/install/zookeeper/zookeeper2/
/opt/install/zookeeper/zookeeper3/
/opt/install/zookeeper/zookeeper4/
/opt/install/zookeeper/zookeeper5/
2.b) Data Directory
/opt/install/zookeeper/data/zookeeper1/
/opt/install/zookeeper/data/zookeeper2/
/opt/install/zookeeper/data/zookeeper3/
/opt/install/zookeeper/data/zookeeper4/
/opt/install/zookeeper/data/zookeeper5/
2.c) Logs Directory
/opt/install/zookeeper/logs/zookeeper1/
/opt/install/zookeeper/logs/zookeeper2/
/opt/install/zookeeper/logs/zookeeper3/
/opt/install/zookeeper/logs/zookeeper4/
/opt/install/zookeeper/logs/zookeeper5/
/opt/install/zookeeper/zookeeper1/
/opt/install/zookeeper/zookeeper2/
/opt/install/zookeeper/zookeeper3/
/opt/install/zookeeper/zookeeper4/
/opt/install/zookeeper/zookeeper5/
2.b) Data Directory
/opt/install/zookeeper/data/zookeeper1/
/opt/install/zookeeper/data/zookeeper2/
/opt/install/zookeeper/data/zookeeper3/
/opt/install/zookeeper/data/zookeeper4/
/opt/install/zookeeper/data/zookeeper5/
2.c) Logs Directory
/opt/install/zookeeper/logs/zookeeper1/
/opt/install/zookeeper/logs/zookeeper2/
/opt/install/zookeeper/logs/zookeeper3/
/opt/install/zookeeper/logs/zookeeper4/
/opt/install/zookeeper/logs/zookeeper5/
3) Download a Zookeeper
3.a) Currently we are using zookeeper-3.4.6.
3.b) From website http://zookeeper.apache.org/releases.html
3.c) Download the latest version of zookeeper software and untar it to /tmp/zookeeper.
3.d) The following steps need to be done for all the zookeeper instances.
3.e) Copy /tmp/zookeeper/zookeeper-3.4.6/* to /opt/install/zookeeper/zookeeper1/
3.f) Copy $ZOO_HOME1/conf/zoo_sample.cfg as zoo.cfg
3.g) Edit zoo.cfg and have the following properties
tickTime=2000
initLimit=10
syncLimit=5
# (make sure directory is present)
dataDir=/opt/install/zookeeper/data/zookeeper1/
# the port at which the clients will connect
clientPort=2181
# (make sure directory is present)
dataLogDir=/opt/install/zookeeper/logs/zookeeper1/
#
server.1=10.10.10.1:2888:3888
server.2=10.10.10.2:2888:3888
server.3=10.10.10.3:2888:3888
server.4=10.10.10.4:2888:3888
server.5=10.10.10.5:2888:3888
4) Create “myid” file in data directory.
4.a) Edit it and write only “1” on server1
4.b) Edit it and write only “2” on server2
4.b) Edit it and write only “2” on server2
4.c) Edit it and write only “3” on server3
4.d) Edit it and write only “4” on server4
4.e) Edit it and write only “5” on server5
5) Start the zookeeper.
($ZOO_HOME/bin/zkServer.sh start on each of the zookeeper instance)
($ZOO_HOME/bin/zkServer.sh start on each of the zookeeper instance)
$ /opt/install/zookeeper/zookeeper1/bin/zkServer.sh start
$ /opt/install/zookeeper/zookeeper2/bin/zkServer.sh start
$ /opt/install/zookeeper/zookeeper3/bin/zkServer.sh start
$ /opt/install/zookeeper/zookeeper4/bin/zkServer.sh start
$ /opt/install/zookeeper/zookeeper5/bin/zkServer.sh start
Sample Output:
JMX enabled by default
Using config: /opt/install/zookeeper/zookeeper1/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
6) To STOP the Zookeeper instances
$ /opt/install/zookeeper/zookeeper1/bin/zkServer.sh stop
$ /opt/install/zookeeper/zookeeper2/bin/zkServer.sh stop
$ /opt/install/zookeeper/zookeeper3/bin/zkServer.sh stop
$ /opt/install/zookeeper/zookeeper4/bin/zkServer.sh stop
$ /opt/install/zookeeper/zookeeper5/bin/zkServer.sh stop
7) To Check the Zookeeper Status
$ /opt/install/zookeeper/zookeeper1/bin/zkServer.sh status
$ /opt/install/zookeeper/zookeeper2/bin/zkServer.sh status
$ /opt/install/zookeeper/zookeeper3/bin/zkServer.sh status
$ /opt/install/zookeeper/zookeeper4/bin/zkServer.sh status
$ /opt/install/zookeeper/zookeeper5/bin/zkServer.sh status
Sample Output
JMX enabled by default
Using config: /opt/install/zookeeper/zookeeper2/bin/../conf/zoo.cfg
Mode: leader
JMX enabled by default
Using config: /opt/install/zookeeper/zookeeper2/bin/../conf/zoo.cfg
Mode: follower
No comments:
Post a Comment