標籤:
Linux下安裝Zookeeper叢集步驟
(1) 下載zookeeper安裝包
地址:http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
(2) 解壓安裝包並放置在對應的路徑下
解壓對應檔案到對應的路徑下,本文將zookeeper解壓到/soft/zk路徑下,並在zk路徑下建立 dataDir與dataLogDir路徑
cd /soft/zk
tar -xvf zookeeper-xxx.tar.gz
mkdir dataDir
mkdir dataLogDir
(3) 配置zookeeper的設定檔
對zookeeper進行配置
cd /soft/zk/zookeeper-xxx/conf
cp zoo-sample.cfg zoo.cfg
vim zoo.cfg
# The number of milliseconds of each tick
tickTime=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=/soft/zk/dataDirdataLogDir=/soft/zk/dataLogDir# the port at which the clients will connectclientPort=2181server.1=192.168.1.111:2888:3888server.2=192.168.1.112:2888:3888server.3=192.168.1.113:2888:3888
這裡對zookeeper伺服器進行配置,這裡需要將myid與對應的伺服器編號對應
(4) 設定zookeeper對應的myid檔案
cd /soft/zk/dataDir
vim myid
將伺服器編號放入
(5) 啟動zookeeper服務
cd /soft/zk/zookeeper-xxx/bin
sh zkServer.sh start
啟動服務,注意查看zookeeper.out這個日誌輸出,可以看到問題點
(6) 驗證zookeeper是否正常啟動
cd /soft/zk/zookeeper-xxx/bin
sh zkServer.sh status
sh zkCli.sh -server 192.168.1.111:2181
(7) 查詢zookeeper伺服器對應的主從關係狀態
cd /soft/zk/zookeeper-xxx/bin
sh zkServer.sh status
CentOS下安裝zookeeper