1. First put the zookeeper decompression package on the three machines and decompress it.
Then zookeeper depends on jdk Yes, then you should also install jdk, which will not be explained in detail here.
mv zookeeper-3.4.5 zookeeper
Modify the node to zookeeper
cd your zookeeper/conf
mv zoo_sample.cfg zoo.cfg
Configure zoo.cfg
vi zoo.cfg
Configure in zoo.cfg
dataDir=/opt/zookeeper/dataDir Set the data storage directory
Configure your zookeeper cluster
server. 0=172.20.51.37:2888:3888
server.1=172.20.51.123:2888:3888
server.2=172.20.51.87:2888:3888
Then enter the zookeeper directory and create a new The directory we just pointed to.
cd /opt/zookeeper
mkdir dataDir
Enter dataDir to create a myid file
Edit in myid, according to the server id enter. For example, the current server is server0, then the content in myid is 0, and the current server is server1, then the content in myid is 1, and so on.
Then turn on zookeeper.
Appendix:
Enter the bin directory./zkServer.sh start open zk
./zkServer.sh stop close zk