Zookeeper Cluster construction
1.zookeeper Cluster Components:
There are three server roles in the Zookeeper cluster,
Leader (master) server,
Follower (slave) server,
Observer (from) server;
2.leader Special is that it has the right to decide, with the request Processor
(The difference between observer server and follower server is that they do not participate in the leader election)
3. Configuration file:
3.1 Modify zoo_sample.cfg to zoo.cfg configuration file (good remember)
/opt/zookeeper-3.4.6/conf under
MV Zoo_sample.cfg Zoo.cfg
3.2 Modifying a configuration file (zoo.cfg)
Datadir=/opt/zookeeper-3.4.6/data (need to create data directory)
server.1=z203 (server name): 2888 (follower and leader communication ports): 3888 (follower election leader Port)
server.2=Z204: 2,888:3,888
server.3=Z205: 2,888:3,888
3.3 In (Datadir=/opt/zookeeper-3.4.6/data) to create a myID file, which content is Server.1 in the 1 (SERVER.2 content is 2)
Z203 Server:
server.1=z203:2888:3888
such as entering the data directory to write commands echo "1" > myID
Z204 Server:
server.2=z204:2888: 3888
such as entering the data directory to write commands echo "2" > myID
Z205 Server:
server.3=z205:2888:3888
such as entering the data directory to write commands echo "3" > myID
3.4 Copy the configured zoo.cfg files to the other nodes
Scp-r/opt/zookeeper-3.4.5/zoo.cfg z204:/opt/zookeeper-3.4.5/
Scp-r/opt/zookeeper-3.4.5/zoo.cfg z205:/opt/zookeeper-3.4.5/
3.5 Note: Be sure to modify the contents of myID on other nodes
In Z204 should talk about myID content changed to 2 (echo "2" > myID)
In Z205 should talk about myID content changed to 3 (echo "3" > myID)
4. Start the cluster
Start separately (into the directory bin) ZK
./zkserver.sh Start
View status
./zkservice.sh Status
This article from "in order to finger that direction" blog, declined reprint!
2. Zookeeper Cluster construction