Windows環境下Zookeeper安裝配置


Windows環境下安裝Zookeeper

配置JDK

Zookeeper啟動需要依賴JDK環境,可以參考:Java之JDK配置

下載解壓

下載地址:https://downloads.apache.org/zookeeper/

解壓到合適的地址,我這邊解壓到:D:\softs\zookeeper-3.4.13

配置文件

進入D:\softs\zookeeper-3.4.13\conf目錄下,Zookeeper已經提供了zoo_sample.cfg文件提供參考示例,我們復制一份命名為zoo.cfg,配置文件修改如下:注意dataDir和dataLogDir根據實際情況修改即可。

# The number of milliseconds of each tick
# Zookeeper 服務之間或客戶端與服務器之間維持心跳的時間間隔,每個tickTime時間就會發送一個心跳,以毫秒為單位
tickTime=2000

# The number of ticks that the initial 
# synchronization phase can take
# Leader-Follower 初始通信時限
# 集群中的 follower 服務器(F)與 leader 服務器(L)之間初始連接時能容忍的最多心跳數(tickTime 的數量)。
initLimit=10

# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
# Leader-Follower 同步通信時限
# 集群中的 follower 服務器與 leader 服務器之間請求和應答之間能容忍的最多心跳數(tickTime的數量)。
syncLimit=5

# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
# 根據實際情況修改 dataDir保存數據,dataLogDir保存日志文件
dataDir=D:\\softs\\zookeeper-3.4.13\\datas 
dataLogDir=D:\\softs\\zookeeper-3.4.13\\logs

# the port at which the clients will connect
# 客戶端連接端口 Zookeeper會監聽這個端口,接受客戶端的訪問請求
clientPort=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=1

啟動測試

至此配置完成,進入bin目錄,執行zkserver.cmd即可啟動服務端。

啟動后將自動生成dataslogs目錄。

測試連接:同樣在bin目錄下,執行zkCli.md啟動客戶端,出現Welcome to Zookeeper就代表啟動成功啦。

參考


免責聲明!

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



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