Windows 環境下Zookeeper本地安裝
阿新 • • 發佈:2020-07-28
官網下載地址:https://archive.apache.org/dist/zookeeper/zookeeper-3.6.1/apache-zookeeper-3.6.1-bin.tar.gz
Zookeeper安裝需要基於java的jdk環境,jdk安裝這裡不再詳細描述,網上安裝方法可以自己查詢下,測試jdk是否安裝成功cmd命令 java -version
檔案下載成功後解壓到自己指定的分割槽中,我是解壓到D盤,進入解壓目錄的conf中,複製zoo_sample.cfg一份並修改名字為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 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:\\apache-zookeeper-3.6.1-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 ## Metrics Providers # # https://prometheus.io Metrics Exporter #metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider #metricsProvider.httpPort=7000 #metricsProvider.exportJvmInfo=true
- tickTime:這個時間是作為 Zookeeper 伺服器之間或客戶端與伺服器之間維持心跳的時間間隔,也就是每個 tickTime 時間就會發送一個心跳。
- dataDir:顧名思義就是 Zookeeper 儲存資料的目錄,預設情況下,Zookeeper 將寫資料的日誌檔案也儲存在這個目錄裡。
- clientPort:這個埠就是客戶端連線 Zookeeper 伺服器的埠,Zookeeper 會監聽這個埠,接受客戶端的訪問請求。
修改完配置後,可以執行bin目錄中的zkServer.cmd指令碼 ,如執行後cmd視窗閃退,可以再末尾新增 pause命令,可以檢視具體錯誤原因。
如執行後報錯誤:找不到或無法載入主類 org.apache.zookeeper.server.quorum.QuorumPeerMain,是由於從版本3.5.5開始,帶有bin名稱的包才是我們想要的下載可以直接使用的裡面有編譯後的二進位制的包,而之前的普通的tar.gz的包裡面是隻是原始碼的包無法直接使用。
安裝成功後效果圖