安裝&配置
在apache的官方網(wǎng)站提供了好多鏡像下載地址,然后找到對應(yīng)的版本
下載地址:
http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
Windows下安裝
把下載的zookeeper的文件解壓到指定目錄
C:\ZK\zookeeper-3.4.14>
修改conf下增加一個zoo.cfg
內(nèi)容如下:
# The number of milliseconds of each tick 心跳間隔 毫秒每次
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting anacknowledgement
syncLimit=5
# the directory where the snapshot isstored. //鏡像數(shù)據(jù)位置
dataDir=C:\\ZK\\data\\zookeeper
#日志位置
dataLogDir=C:\\ZK\\logs\\zookeeper
# the port at which the clients willconnect 客戶端連接的端口
clientPort=2181
注:如果啟動有報錯提示cfg文件有錯誤,可以用zoo_sample.cfg內(nèi)內(nèi)容替代也是可以的
進入到bin目錄,并且啟動zkServer.cmd,這個腳本中會啟動一個java進程
C:\ZK\zookeeper-3.4.14>cd bin
C:\ZK\zookeeper-3.4.14\bin>
C:\ZK\zookeeper-3.4.14\bin >zkServer.cmd
啟動后jps可以看到QuorumPeerMain的進程
C:\ZK\zookeeper-3.4.14\bin >jps
啟動客戶端運行查看一下
C:\ZK\zookeeper-3.4.14\bin>zkCli.cmd -server 127.0.0.1:2181
這個時候zookeeper已經(jīng)安裝成功了,
參考官方文檔:
http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html
參考單機模式、集群和偽集群的帖子
http://sqcjy111.iteye.com/blog/1741320
在 一臺機器上通過偽集群運行時可以修改 zkServer.cmd 文件在里面加入
set ZOOCFG=..\conf\zoo1.cfg 這行,另存為 zkServer-1.cmd

如果有多個可以以此類推





還需要 在對應(yīng)的
C:\\ZK\\data\\zookeeper\\1,
C:\\ZK\\data\\zookeeper\\2,
C:\\ZK\\data\\zookeeper\\3
建立一個文本文件命名為myid,內(nèi)容就為對應(yīng)的zoo.cfg里server.后數(shù)字

總結(jié)
以上所述是小編給大家介紹的windows系統(tǒng)搭建zookeeper服務(wù)器的教程,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!