上传zookeeper-3.4.5.tar.gz到linux的/usr/local目录下面
执行命令:
tar -zxvf zookeeper-3.4.5.tar.gz
rm -rf zookeeper-3.4.5.tar.gz
mv zookeeper-3.4.5 zk
执行命令添加环境变量:vim ~/.bashrc
export ZOOKEEPER_HOME=/usr/local/zk
export PATH=$PATH:$ZOOKEEPER_HOME/bin
执行命令:source ~/.bashrc
cd /usr/local/zk/conf
mv zoo_sample.cfg zoo.cfg
vim zoo.cfg
新增:
server.0=192.168.2.161:2888:3888
server.1=192.168.2.162:2888:3888
server.2=192.168.2.163:2888:3888
修改:
dataDir=/usr/local/zk/data
执行命令:
mkdir -p /usr/local/zk/data
cd /usr/local/zk/data
vim myid
三个节点分别写入0 1 2
启动zk:zkServer.sh start
查询zk状态:zkServer.sh status