標籤:com nis nec mil style 網域名稱 where 進程 str
一.簡介
zooKeeper是一個分布式的,開放源碼的分布式應用程式協調服務,是Google的Chubby一個開源的實現,是Hadoop和Hbase的重要組件。它是一個為分布式應用提供一致性服務的軟體,提供的功能包括:配置維護、網域名稱服務 (DNS)、分布式同步、組服務等。
zooKeeper的目標就是封裝好複雜易出錯的關鍵服務,將簡單易用的介面和效能高效、功能穩定的系統提供給使用者。
zooKeeper包含一個簡單的原語集,提供Java和C的介面。
zooKeeper代碼版本中,提供了分布式獨享鎖、選舉、隊列的介面,代碼在zookeeper-3.4.8\src\recipes。其中分布鎖和隊列有Java和C兩個版本,選舉只有Java版本。
二.下載
Apache官方下載,:https://www.apache.org/dyn/closer.cgi/zookeeper/
三.安裝
解壓到指定目錄下D:\software\zookeeper-3.4.11
修改zoo_sample.cfg 檔案名稱(D:\soft\zookeeper-3.4.8\conf) 為 zoo.cfg
主要修改一下日誌位置,具體設定檔如下:
# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.dataDir=D:\\software\\zookeeper-3.4.11\\datadataLogDir=D:\\software\\zookeeper-3.4.11\\log # the port at which the clients will connectclientPort=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.dataLogDir:顧名思義就是 zookeeper 儲存記錄檔的目錄
4.clientPort:這個連接埠就是用戶端串連 zookeeper 伺服器的連接埠,Zookeeper 會監聽這個連接埠,接受用戶端的訪問請求。
四.啟動
進入到bin目錄,並且啟動zkServer.cmd,這個指令碼中會啟動一個java進程。
啟動後jps可以看到QuorumPeerMain的進程。
也可以啟動用戶端串連一下
OK,安裝成功,很簡單。
參考文章:52028945
windows環境下zookeeper安裝和使用