以zoo1.cfg爲例:java
dataDir=E:\\Develop\\zookeeper\\3.4.6\\zookeeper-3.4.6\\data1 dataLogDir=E:\\Develop\\zookeeper\\3.4.6\\zookeeper-3.4.6\\log1 clientPort=12181 server.1=127.0.0.1:12887:13887 server.2=127.0.0.1:12888:13888 server.3=127.0.0.1:12889:13889
myid內容爲node
1
增長一行:
set ZOOCFG=%ZOOCFGDIR%\zoo1.cfgapache
set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain echo on set ZOOCFG=%ZOOCFGDIR%\zoo1.cfg java "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %*
分別啓動zkServer1.cmd、zkServer2.cmd、zkServer3.cmd測試
用客戶端分別鏈接server1和server2,在server1上建立一個node,在server2上觀察是否建立成功;.net
[zk: 127.0.0.1:12181(CONNECTED) 1] create /test test1
[zk: 127.0.0.1:12182(CONNECTED) 1] get /test