序号 | 机器 | 类型 |
---|
1 | 192.168.33.111 | centos7 |
2 | 192.168.33.112 | centos7 |
1.下载包上传到服务器192.168.33.111的home目录下
2.解压zookeeper
tar -zxvf zookeeper-3.4.14
3.进入zookeeper文件夹
cd zookeeper-3.4.14
4.建立data文件夹
mkdir data
5.配置zoo.cfg
cd conf
cp zoo_sample.cfg zoo.cfg
vi zoo.cfg
修改data目录
dataDir=/usr/local/zookeeper/data
添加
server.1=192.168.33.111:2888:3888
server.2=192.168.33.112:2888:3888
6.创建myid文件
cd ../data
touch myid
echo "1">>myid
7.拷贝zookeeper到另一台机器
scp -r /home/zookeeper-3.4.14/ root@192.168.33.112:/home/
8.登录192.168.33.112机器,修改机器2的zookeeper的myid
cd /usr/local/zookeeper/data
echo "2">>myid
9.关闭防火墙
关闭: systemctl stop firewalld
查看状态: systemctl status firewalld
开机禁用 : systemctl disable firewalld
10.启动,两台机器都执行
/home/zookeeper-3.4.14/bin/zkServer.sh start
11.验证
/home/zookeeper-3.4.14/bin/zkServer.sh status
/home/zookeeper-3.4.14/bin/zkCli.sh -server 192.168.33.111:2181
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/a43ed98f6d9f596accfaf50e0b429f8a.png)