Zookeeper Cluster Deployment
- Download Zookeeper
Using the Zookeeper 3.4.11
as example. Please make sure the java open jdk7
runtime environment is installed on the server.
- Modify the configuration file
$ cp conf/zoo_sample.cfg conf/zoo.cfg
$ vim conf/zoo.cfg
- The configuration file is modified as below
tickTime=2000
initLimit=10
syncLimit=5
dataLogDir=/opt/app/zookeeper/logs
clientPort=2181
server.2=192.168.2.81:2888:3888
server.3=192.168.2.82:2888:3888
- Create a data folder
Do the same installation to the other servers which need install zookeeper.
- Create a Zookeeper node identification file
myid
Create myid
number, execution on each server, pay attention to each servermyid
to correspond to the correct number.
192.168.2.80
192.168.2.81
$ echo "2" > /opt/app/zookeeper/zkdata/myid
- Start Zookeeper
$ /opt/app/zookeeper/bin/zkServer.sh start
192.168.2.81
$ /opt/app/zookeeper/bin/zkServer.sh start
- Zookeeper status check
$ /opt/app/zookeeper/bin/zkServer.sh status
If the Zookeeper start failed, please check the below reasons:
2、The integer in the myid
file is not formatted correctly or does not correspond to the server integer inzoo.cfg
.
3、The firewall does not open the Zookeeper service port, such as 2888
and3888
.