1长搀、下載zookeeper
zookeeper.apache.org/
2、安裝zookeeper
# 解壓縮
tar -zxvf apache-zookeeper-3.7.0-bin.tar.gz
# 創(chuàng)建安裝文件
mkdir /opt/liws
# 移動(dòng)解壓縮后的文件
mv apache-zookeeper-3.7.0-bin /opt/liws
# 編輯/etc/profile
vi /etc/profile
# 在/etc/profile文件中添加如下
export ZOOKEEPER_HOMR=/opt/liws/apache-zookeeper-3.7.0-bin
export PATH=$PATH:$ZOOKEEPRT_HOME/bin
# 令/etc/profile添加的配置生效
source /etc/profile
3鸡典、修改zookeeper的配置文件
cd apache-zookeeper-3.7.0-bin/conf
cp zoo_sample.cfg zoo.cfg
vi zoo.cfg
# 配置數(shù)據(jù)文件路徑和日志文件路徑源请,若不存在,則需創(chuàng)建
dataDir=/opt/liws/zk/data
dataLogDir=/opt/liws/zk/log
# 若需要配置集群彻况,則需添加以下
server.1=node01:2888:3888
server.2=node02:2888:3888
server.3=node03:2888:3888
server.4=node04:2888:3888
4谁尸、創(chuàng)建myid
# 在/opt/liws/zookeeper目錄下,創(chuàng)建myid文件纽甘,并寫(xiě)入序號(hào)1~4中任一個(gè)良蛮。序號(hào)與集群節(jié)點(diǎn)有關(guān),即與server.1中的數(shù)字一致
vi myid
5贷腕、啟動(dòng)zookeeper
cd apache-zookeeper-3.7.0-bin/bin
./zkServer.sh start
jps