Windows環境下Zookeeper的安裝及啟動


一、下載及安裝配置 JDK (Kafka依賴於Zookeeper服務,而Zookeeper的運營依賴JDK)

1.地址:https://www.oracle.com/java/technologies/javase-jdk14-downloads.html

下載windows可執行文件,直接點擊安裝,默認下一步,直到完成安裝。

2.配置JDK

我的電腦  --> 右鍵 ---> 屬性  --> 高級系統設置  -- > 環境變量

添加 JAVA_HOME變量:C:\Program Files\Java\jdk-14.0.2

添加 CLASSPATH變量:%JAVA_HOME%\lib

在PATH變量中加入:%JAVA_HOME%\bin

打開CMD,驗證JDK是否安裝成功

 

 

 

二、下載安裝配置 Zookeeper服務

1.地址:https://mirror-hk.koddos.net/apache/zookeeper/stable/

2.修改配置文件:conf 文件夾,在里面復制一份zoo_sample.cfg並重命名為zoo.cfg文件。

(這里我主要修改了日志存儲地址:dataDir)

# 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 an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=D:\\AmandaSoft\\apache-zookeeper-3.5.8-bin\\data
# the port at which the clients will connect
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

 

配置文件簡單解析
  1.tickTime:這個時間是作為 zookeeper 服務器之間或客戶端與服務器之間維持心跳的時間間隔,也就是每個 tickTime 時間就會發送一個心跳。
  2.dataDir:顧名思義就是 zookeeper 保存數據的目錄,默認情況下,Zookeeper 將寫數據的日志文件也保存在這個目錄里。
  3.clientPort:這個端口就是客戶端連接 zookeeper 服務器的端口,Zookeeper 會監聽這個端口,接受客戶端的訪問請求。

 

3.進入..\apache-zookeeper-3.5.8-bin\bin目錄

 

 

 會出現以下很長一段:可以看到QuorumPeerMain的進程

 

 可通過雙擊 zkCli.cmd啟動客戶端

 


免責聲明!

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



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