Install zookeeper cluster steps under Linux
(1) Download Zookeeper installation package
Address: http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
(2) Unzip the installation package and place it under the corresponding path
Unzip the corresponding file to the corresponding path, this article will extract the zookeeper to the/SOFT/ZK path, and in the ZK path to establish DataDir and Datalogdir path
Cd/soft/zk
TAR-XVF zookeeper-xxx.tar.gz
mkdir DataDir
mkdir Datalogdir
(3) Configuring the Zookeeper configuration file
Configuring the Zookeeper
Cd/soft/zk/zookeeper-xxx/conf
CP Zoo-sample.cfg Zoo.cfg
Vim Zoo.cfg
# The number of milliseconds of each tick
Ticktime= -# The number of ticks that the initial# synchronization phase can takeinitlimit=Ten# The number of ticks that can pass between# sending a request and getting an acknowledgementsynclimit=5# The directory where the snapshot is stored.# DoNot use/tmp forStorage,/tmp Here is just# example Sakes.datadir=/soft/zk/Datadirdatalogdir=/soft/zk/datalogdir# the Port atwhichThe clients would connectclientport=2181server.1=192.168.1.111:2888:3888server.2=192.168.1.112:2888:3888server.3=192.168.1.113:2888:3888
The zookeeper server is configured here, and it is necessary to match the myID with the corresponding server number
(4) Set the zookeeper corresponding myID file
Cd/soft/zk/datadir
Vim myID
Put the server number in
(5) Start zookeeper service
Cd/soft/zk/zookeeper-xxx/bin
SH zkserver.sh start
Start the service, pay attention to see zookeeper.out This log output, you can see the problem point
(6) Verify that the zookeeper is starting normally
Cd/soft/zk/zookeeper-xxx/bin
SH zkserver.sh status
SH zkcli.sh-server 192.168.1.111:2181
(7) Query the zookeeper server corresponding to the master-slave relationship status
Cd/soft/zk/zookeeper-xxx/bin
SH zkserver.sh status
Installing zookeeper under CentOS