installation of Zookeeper (standalone version) in Linux has introduced how to build a standalone version of Zookeeper in Linux, this article will continue to build the cluster version of zookeeper based on the previous article.
On the original basis, two more virtual machines are prepared:
My virtual machine IP is: 192.168.174.132,192.168.174.130,192.168.174.131
The corresponding hostname are: master,slave1,slave2
Hostname can be viewed and modified by itself: http://jingyan.baidu.com/article/574c52192a1d8d6c8d9dc1ce.html
Specific steps:
1. Modify thecontent under/home/hadoop/zookeeper/conf in the standalone version
Add the following content:
Datadir=/home/hadoop/zookeeper/datadatalogdir=/home/hadoop/zookeeper/logserver.1=master:2888:3888server.2= slave1:2888:3888server.3=slave2:2888:3888
2. Create a folder
CD/HOME/HADOOP/ZOOKEEPER/MKDIR-M 755 datamkdir-m 755 Log
3, in the Data folder to create a new myID file, myID content is:
CD Datavim myID
Added content: 1
Save and Exit!
4, send the zookeeper of the machine to other machines (see the small hint first)
Scp-r/home/hadoop/zookeeper [email protected]:/home/hadoop/scp-r/home/hadoop/zookeeper [email protected]:/home/ hadoop/
Small Tip :
(1), add the Hosts file contents on the master corresponding machine: vim/etc/hosts
192.168.174.130 slave1192.168.174.131 Slave2
(2), add the Hosts file content on the slave1 corresponding machine: vim/etc/hosts
192.168.174.132 master192.168.174.131 Slave2
(3), add the Hosts file content on the slave2 corresponding machine: vim/etc/hosts
192.168.174.130 slave1192.168.174.131 Slave2
5, modify the other machine's configuration file
To slave1: Modify the myID to: 2
To Slave2: Modify the myID to: 3
6, respectively start Master, Slave1, slave2 in the zookeeper
Start in turn (per machine)
zkserver.sh start
7. View cluster status
zkserver.sh status #查看集群状态, master-slave information
See that the cluster installation for zookeeper is successful. Leader and follower have identified
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/8A/A3/wKiom1g1s4HxWm8-AAB92gKIb5k349.png "style=" float: none; "title=" A.png "alt=" Wkiom1g1s4hxwm8-aab92gkib5k349.png "/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/8A/9F/wKioL1g1s4LggvxPAACCJsaUMSA113.png "style=" float: none; "title=" B.png "alt=" Wkiol1g1s4lggvxpaaccjsaumsa113.png "/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/8A/A3/wKiom1g1s4PizgS0AACFkytx2pM191.png "style=" float: none; "title=" C.png "alt=" Wkiom1g1s4pizgs0aacfkytx2pm191.png "/>
This article is from the "Simplelife" blog, make sure to keep this source http://simplelife.blog.51cto.com/9954761/1875985
Install zookeeper under Linux (Cluster Edition)