zookeeper簡單搭建
阿新 • • 發佈:2018-11-10
● 下載zookeeper安裝包
● 上傳至linux,解壓
[[email protected] zookeeper-3.4.10]# pwd
/usr/local/apps/zookeeper-3.4.10
● 修改配置檔案
[[email protected] zookeeper-3.4.10]# cd conf/ [[email protected] conf]# cp zoo_sample.cfg zoo.cfg #修改如下: #修改zookeeper資料儲存位置 dataDir=/usr/local/apps/zookeeperData #新增zookeeper節點(我這就一個,叢集配置多個) server.0=localhost:2888:3888
#到dataDir的目錄建立myid,myid寫入0(zoo.cfg的節點server.0),多臺節點的myid不能重複!!!不能重複!!不能重複!!
[[email protected] conf]# cd /usr/local/apps/zookeeperData
[[email protected] zookeeperData]# echo 0 >> myid
● 啟動zookeeper (多個節點到每臺機器上啟動,或者自己寫個指令碼)
[[email protected] zookeeper-3.4.10]# ./bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/apps/zookeeper-3.4.10/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[ [email protected] zookeeper-3.4.10]# jps
14263 Launcher
19254 Jps
19231 QuorumPeerMain
● 檢視zookeeper狀態
[[email protected] zookeeper-3.4.10]# ./bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/apps/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: standalone