Zookeeper cluster installation
The package included in the article plus the bottom of the free access
Software version 3.4.8
Upload zookeeper-3.4.8.tar.gz to App server directory:/USR/LOCAL/SRC (package see attachment)
168.0.1 for App server ip192.168.0.2 to DB server IP
#cd/USR/LOCAL/SRC
#tar-ZXVF zookeeper-3.4.8.tar.gz
#mv zookeeper-3.4.8 Zookeeper
#vim/etc/profile//Add the following to the end of the file and save
#ZOOKEEPER
Zookeeper=/usr/local/src/zookeeper
Path= $PATH: $ZOOKEEPER/bin
#source/etc/profile
#cp/usr/local/src/zookeeper/conf/zoo_sample.cfg/usr/local/src/zookeeper/conf/zoo.cfg
#mkdir/DATA/ZOOKEEPER-PV
#vim/usr/local/src/zookeeper/conf/zoo.cfg//Modify the contents of the file as follows
ticktime=2000
initlimit=10
Synclimit=5
Datadir=/data/zookeeper
clientport=2181
minsessiontimeout=1000
maxsessiontimeout=10000
server.1=192.168.0.1:2888:3888
server.2=192.168.0.2:2888:3888
Server. A=b:c:d: Where A is a number, indicating this is the first server, B is the IP address of this server, C is the server and the Leader server in the cluster to exchange information on the port; D means that in case the Leader server in the cluster hangs, a port is needed to re-elect , select a new Leader, which is the port that the server communicates with each other when the election is performed. If it is a pseudo-cluster configuration, because B is the same, so different Zookeeper instance communication port numbers can not be the same, so they should be assigned a different port number.
Perform the above installation steps on both the app server and the DB server
Then do the following
192.168.0.1 this machine.
#echo "1" >/data/zookeeper/myid
192.168.168.0.2 this machine.
#echo "2" >/data/zookeeper/myid
Start two zookeeper
#/usr/local/zookeeper/bin/zkserver start
#zkServer. SH Status//query zookeeper State
#zkCli. Sh-server 192.168.0.1 (192.168.0.2): 2181//The connection to the service cluster can be established on either node
If you are interested in this, please scan the QR code below for free for more details
Linux/centos Zookeeper cluster installation