windows系統搭建zookeeper


 安裝&配置

在apache的官方網站提供了好多鏡像下載地址,然后找到對應的版本

下載地址:

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

內容如下:

# 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.  //鏡像數據位置

dataDir=C:\\ZK\\data\\zookeeper

#日志位置

dataLogDir=C:\\ZK\\logs\\zookeeper

# the port at which the clients willconnect  客戶端連接的端口

clientPort=2181

注:如果啟動有報錯提示cfg文件有錯誤,可以用zoo_sample.cfg內內容替代也是可以的

 

 

進入到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已經安裝成功了,

參考官方文檔:

http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html

 參考單機模式、集群和偽集群的帖子

http://sqcjy111.iteye.com/blog/1741320

 

在 一台機器上通過偽集群運行時可以修改 zkServer.cmd 文件在里面加入

set ZOOCFG=..\conf\zoo1.cfg  這行,另存為  zkServer-1.cmd


如果有多個可以以此類推

 

 

還需要 在對應的

C:\\ZK\\data\\zookeeper\\1,

C:\\ZK\\data\\zookeeper\\2,

C:\\ZK\\data\\zookeeper\\3

 建立一個文本文件命名為myid,內容就為對應的zoo.cfg里server.后數字

  

  

 


參考資料:

https://blog.51cto.com/antlove/2070335

https://blog.csdn.net/morning99/article/details/40426133

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM