Install under Windows
Extract the downloaded zookeeper files to the specified directory
E:\Program\zookeeper-3.4.6
Modify conf under Add Zoo1.cfg,zoo2.cfg,zoo3.cfg
# the number of milliseconds of each tickticktime=2000# the Number of ticks that the initial # synchronization phase can takeinitlimit=10# the number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# The directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.datadir=/program/ zk_data/1# the port at which the clients will connectclientport=2181# the maximum number of client connections.# increase this if you need to handle more clients#maxclientcnxns=60## be sure to read the maintenance section of the # administrator guide before turning on autopurge.## http://zookeeper.apache.org/doc/current/zookeeperadmin.html#sc_maintenance## the Number of snapshots to retain in datadir#autopurge.snapretaincount=3# purge task interval in hours# Set to "0" to disable auto purge feature#autopurge.purgeinterval=1server.1=127.0.0.1:2887:3887server.2=127.0.0.1:2888:3888server.3= 127.0.0.1:2889:3889
Corresponds to three instances:
ClientPort three files for 2181,2182,2183
DataDir three files for /program/zk_data/1,/program/zk_data/2,/program/zk_data/3
within three DataDir, create a myID file with content corresponding to
Copy zkserver.cmd for zkserver1.cmd,zkserver2.cmd,zkserver3.cmd
modify cmd, add set zoocfg=. \conf\zoo1.cfg, three cmd files correspond to their respective CFG files, for example:
Setlocalcall "%~dp0zkenv.cmd" set Zoomain=org.apache.zookeeper.server.quorum.quorumpeermainset ZOOCFG=. \conf\zoo1.cfgecho Onjava "-dzookeeper.log.dir=%zoo_log_dir%" "-dzookeeper.root.logger=%zoo_log4j_prop%"-CP "% classpath% "%zoomain%"%zoocfg% "%*endlocal
Start three cmd, which will complete the communication between several nodes
With JPS, you will see three startup Java Master processes
Zookeeper installation and startup of pseudo-clusters under windows