生活随笔
收集整理的這篇文章主要介紹了
zookeeper windows 下安装
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
前沿:最近公司做的項目用到了dubbo 和 zookeeper 由于 每次測試的時候 我本地的服務就會注冊到測試機上,還得每次把測試機的服務停止掉,所以準備在本地搭建一個zookeeper。
安裝過程
? ? ?2.1 ?http://mirrors.hust.edu.cn/apache/zookeeper/ ?下載,我的版本是?3.3.6
? ? ?2.2 ?解壓到 E:\zookeeper-3.3.6?
? ? ?3.3 ?到目錄conf 下創建?zoo.cfg 文件,默認就是加載這個文件,文件內容 我直接copy 的sample里面的
? ? ? ? ??
Java代碼??
#?The?number?of?milliseconds?of?each?tick??檢查心跳的時間
tickTime=2000
#?The?number?of?ticks?that?the?initial?
#?synchronization?phase?can?take??初始化時,鏈接到服務器端的間隔次數,總時間10*2=20秒
initLimit=10
#?The?number?of?ticks?that?can?pass?between?
#?sending?a?request?and?getting?an?acknowledgement??ZK?leader?和?follower?之間通訊的次數,總時間?5*2=10秒
syncLimit=5
#?the?directory?where?the?snapshot?is?stored.
#?do?not?use?/tmp?for?storage,?/tmp?here?is?just?
#?example?sakes.?#?存儲內存中數據庫快照的位置,如果不設置參數,更新事務日志將被存儲到默認位置。?
dataDir=E:\\zk\\tmp\\zookeeper
#?錯誤日志的存放位置?????
dataLogDir=E:\\zk\\logs\\zookeeper
#?the?port?at?which?the?clients?will?connect?ZK?服務器端的監聽端口
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?
? ?上面的說明介紹:http://zookeeper.apache.org/doc/current/zookeeperStarted.html
? ?然后 cd 到bin 目錄下 執行zkServer.cmd 就啟動成功了。
? ?注意:dataDir ?和 ?dataLogDir 目錄不會自動創建,得手動創建才能啟動。
? ?可以用netstat -ano|findstr "2181" 看看是否OK。
? ?也可以用JPS 查看啟動的JAVA 進程的情況,會出現這樣
? ?
Java代碼?
C:\windows\system32>jps??
8068??
10040?QuorumPeerMain??//?這東西是zk的東西,源碼有介紹??
10556?Jps ???也可以用自帶客戶端命令?:??zkCli.cmd?-server?127.0.0.1:2181
? ?關于JPS的東西,可以自己去JAVA_HOME\bin 目錄下去看,里面很多命令。
未完待續
轉載于:https://my.oschina.net/u/2325281/blog/544272
總結
以上是生活随笔為你收集整理的zookeeper windows 下安装的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。