1.首先你得具备一个安装包
链接:https://pan.baidu.com/s/1uSLSeBL9m3XtgIu4i3NTfg
提取码:ux70
2.上传 解压
tar -zxvf zookeeper-3.4.5-cdh5.14.0.tar.gz -C /export/servers/
3.修改环境变量(注意:3台zookeeper都需要修改)
vim /etc/profile.d/zookeeper.sh
export ZOOKEEPER_HOME=/export/servers/zookeeper-3.4.5-cdh5.14.0
export PATH=$PATH:$ZOOKEEPER_HOME/bin
scp zookeeper.sh node10:$PWD
scp zookeeper.sh node11:$PWD
source /etc/profile
4.修改zookeeper配置文件
cd /export/servers/zookeeper-3.4.5-cdh5.14.0/conf
dataDir=/export/servers/zookeeper-3.4.5-cdh5.14.0/zkdata
server.1=node09:2888:3888
server.2=node10:2888:3888
server.3=node11:2888:3888
5.创建文件夹
mkdir -p /export/servers/zookeeper-3.4.5-cdh5.14.0/zkdata
6.在zkdata文件夹下新建myid文件,myid的文件内容为:
cd /export/servers/zookeeper-3.4.5-cdh5.14.0/zkdata
echo 1 > myid
7.分发安装包到其他节点
scp -r /export/servers/zookeeper-3.4.5-cdh5.14.0 root@node10:/export/servers
scp -r /export/servers/zookeeper-3.4.5-cdh5.14.0 root@node11:/export/servers
8.修改其他机器的配置文件
在node02上:
vim /export/servers/zookeeper-3.4.5-cdh5.14.0/zkdata/myid
修改myid为:2
在node03上:
vim /export/servers/zookeeper-3.4.5-cdh5.14.0/zkdata/myid
修改myid为:3
9.三台节点启动
zkServer.sh start