Download: zookeeper:http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz Decompression zookeeper-3.4.6.tar.gzone, single-machine configurationChange the zookeeper-3.4.6/conf/zoo_sample.cfg to Zoo.cfgzoo.cfg Content: Ticktime=2000the interval between//zookeeper servers or between the client and the server to maintain heartbeat Initlimit=5the//zookeeper cluster contains multiple servers, one of which is leader, and the remaining servers in the cluster are follower. Initlimit parameters Configure the maximum heartbeat time between follower and leader when the connection is initialized. At this point the parameter is set to 5, stating that the time limit is 5 times times ticktime, or 5*2000=10000ms=10s. Synclimit=2//This parameter configures the maximum length of time for messages, requests, and responses to be sent between leader and follower. This parameter is set to 2, which indicates a time limit of twice times ticktime, or 4000ms. DataDir=d:\\tools\\zookeeper-3.4.6\\data//zookeeper The directory where the data is stored ClientPort=2181//The client connects to the port of the Zookeeper server, Zookeeper listens on the port, accepts the client's access request to start Zookeeper execution Bin/zkserver.cmd second, pseudo-cluster configurationCreate 3 configuration files in the zookeeper-3.4.6/conf/directory: zoo1.cfg,Zoo2.cfg,zoo3.cfg
zoo1.cfg Content: Ticktime=2000
Initlimit=5Synclimit=2
DataDir=d:\\tools\\zookeeper-3.4.6\\data\\1
ClientPort=2181
Server.1=localhost:2887:3887Server.2=localhost:2888:3888server.3=localhost:2889:3889zoo2.cfg Content: Ticktime=2000
Initlimit=5Synclimit=2
DataDir=d:\\tools\\zookeeper-3.4.6\\data\\2 ClientPort=2182
Server.1=localhost:2887:3887Server.2=localhost:2888:3888server.3=localhost:2889:3889zoo3.cfg Content: Ticktime=2000
Initlimit=5Synclimit=2
DataDir=d:\\tools\\zookeeper-3.4.6\\data\\3
ClientPort=2183
Server.1=localhost:2887:3887Server.2=localhost:2888:3888server.3=localhost:2889:3889 Note: server. X=A:B:C where x is a number that indicates which is the first server. A is the IP address where the server resides. b Configure the port used by the server and the leader in the cluster to exchange messages. C Configure the port to use when electing leader. Because the pseudo-cluster mode is configured, the B and C parameters of each server must be different. Create a zookeeper-3.4.6\data\1, zookeeper-3.4.6\data\2, zookeeper-3.4.6\data\3 directory, respectivelymyIDFiles, the contents of the myID file are 1, 2, 3, respectively
Create 3 configuration files in the zookeeper-3.4.6/bin/directory: Zkevn1.cmd, zkevn2.cmd, Zkevn3.cmd
Modify set zoocfg=%zoocfgdir%\zoo.cfg to: Set zoocfg=%zoocfgdir%\zoo1.cfg, set zoocfg=% zoocfgdir%\zoo2.cfg, set zoocfg=%zoocfgdir%\zoo3.cfg Create 3 configuration files in the zookeeper-3.4.6/bin/directory: Zkserver1.cmd, zkserver2.cmd, zkserver3.cmdModify the call "%~dp0" separatelyZkenv.cmd"For: Call"%~dp0Zkenv1.cmd", call"%~dp0Zkenv2.cmd", call"%~dp0Zkenv3.cmd"
The zookeeper server is started by executing Zkserver1.cmd, Zkserver2.cmd, and Zkserver3.cmd respectively.
Zookeeper WINDOWS Installation Configuration