確保系統(tǒng)已經(jīng)安裝JDK驰弄,如果未安裝补君,首先需要進行安裝JDK刹前,參考Linux(CentOS 7)安裝JDK踩坑記錄
在ZooKeeper官網(wǎng)下載安裝包
現(xiàn)在最新穩(wěn)定版本為3.6.1为鳄,下載地址為:https://www.apache.org/dyn/closer.lua/zookeeper/zookeeper-3.6.1/apache-zookeeper-3.6.1-bin.tar.gz
- 安裝ZooKeeper
將下載的壓縮文件傳輸?shù)紺entOS中的/usr/local/zookeeper目錄下面净宵,進行解壓tar zxvf apache-zookeeper-3.6.1-bin.tar.gz
- 編輯配置文件
進入conf目錄孟害,將zoo_sample.cfg這個文件復制為zoo.cfg:cp zoo_sample.cfg zoo.cfg
修改zoo.cfg拒炎,配置dataDir和DataLogDir
dataDir=/usr/local/zookeeper/apache-zookeeper-3.6.1-bin/data
dadaLogDir=/usr/local/zookeeper/apache-zookeeper-3.6.1-bin/log
※為什么要做這樣的修改呢?
看zoo_sample.cfg中的注釋挨务,do not use /tmp for storage, /tmp here is just
當然击你,配置完目錄之后別忘了在創(chuàng)建data和log目錄
- 配置環(huán)境變量
打開配置文件:vim /etc/profile
export ZOOKEEPER_INSTALL=/usr/local/zookeeper/apache-zookeeper-3.6.1-bin/
export PATH=$PATH:$ZOOKEEPER_INSTALL/bin
使其生效:source /etc/profile
-
啟動ZooKeeper服務端
命令:sh zkServer.sh start
-
啟動ZooKeeper客戶端進行連接
命令:sh zkCli.sh