windows系統搭建zookeeper

 安裝&配置

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

下載地址:java

http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gzapache

 

Windows下安裝網站

把下載的zookeeper的文件解壓到指定目錄.net

C:\ZK\zookeeper-3.4.14>3d

修改conf下增長一個zoo.cfg日誌

內容以下:server

# The number of milliseconds of each tick  心跳間隔 毫秒每次htm

tickTime=2000blog

# 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

http://www.javashuo.com/article/p-mpjdxbxm-gr.html

相關文章
相關標籤/搜索