Prerequisites: JDK and Hadoop have been configured, and a Hadoop cluster (three hosts only) has been set up.
1. Unpack the zookeeper – 3.4.10. Tar. Gz
Tar -zxvf zookeeper-3.4.10.tar.gz -c /opt/module/Copy the code
2. CD Go to the Decompressed Zookeeper directory and create a zkdata folder (/opt/module/zookeeper-3.4.10/ zkdata directory).
3. Go to the conf file and modify the zoo_sample. CFG
Rename zoo_sample. CFG to zoo.cfg(nice look)
4. Configuration zoo. CFG
DataDir =/opt/module/zookeeper-3.4.10/zkData
(2) add :(zzf111 is the hostname)
server.1=zzf111:2888:3888
server.2=zzf112:2888:3888
server.3=zzf113:2888:3888
5. Add environment variable /opt/module/zookeeper-3.4.10
vi /etc/profileCopy the code
At the end of the profile file add:
exportZK_HOME = / opt/module/zookeeper - 3.4.10export PATH=TH=$PATH:$ZK_HOME/binCopy the code
then
source /etc/profileCopy the code
6. Go to the zkData folder and create a myID file
And then the vi myid
By adding a number to myID (the number after server), zzf111 users add the number 1
7. Go to the directory on zooKeeper and upload ZooKeeper-3.4.10 to another host
8. For zzf112, change the myid file under zkData to 2.
Zzf113 host same method
9. Start the ZooKeeper cluster. Run the script to start the ZooKeeper service on each node of the ZooKeeper cluster, as shown in the following figure
Bin/zkserver. sh start (Check the status of all three hosts.) bin/ zkserver. sh statusCopy the code
At this point, the distribution of ZooKeeper is complete