cp /root/zookeeper363_03/conf/zoo_sample.cfg /root/zookeeper363_03/conf/zoo.cfg
zookeeper01
/root/zookeeper363_01/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/root/zookeeper363_01/data
dataLogDir=/root/zookeeper363_01/logs
clientPort=2281
server.1=192.168.8.201:2222:2223
server.2=192.168.8.201:3333:3334
server.3=192.168.8.201:4444:4445
echo 1 > /root/zookeeper363_01/data/myid
1
zookeeper02
/root/zookeeper363_02/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/root/zookeeper363_02/data
dataLogDir=/root/zookeeper363_02/logs
clientPort=2282
server.1=192.168.8.201:2222:2223
server.2=192.168.8.201:3333:3334
server.3=192.168.8.201:4444:4445
echo 2 > /root/zookeeper363_02/data/myid
2
zookeeper03
/root/zookeeper363_03/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/root/zookeeper363_03/data
dataLogDir=/root/zookeeper363_03/logs
clientPort=2282
server.1=192.168.8.201:2222:2223
server.2=192.168.8.201:3333:3334
server.3=192.168.8.201:4444:4445
echo 3 > /root/zookeeper363_03data/myid
3
关闭防火墙
# 生产环境打开对应端口
systemctl disable firewalld
逐一开启服务
sh ~/zookeeper363_01/bin/zkServer.sh start ~/zookeeper363_01/conf/zoo.cfg
sh ~/zookeeper363_02/bin/zkServer.sh start ~/zookeeper363_02/conf/zoo.cfg
sh ~/zookeeper363_03/bin/zkServer.sh start ~/zookeeper363_03/conf/zoo.cfg
查看服务状态
sh ~/zookeeper363_01/bin/zkServer.sh status
# ZooKeeper JMX enabled by default
# Using config: /root/zookeeper363_03/bin/../conf/zoo.cfg
# Client port found: 2283. Client address: localhost. Client SSL: false.
# Mode: follower
sh ~/zookeeper363_02/bin/zkServer.sh status
# ZooKeeper JMX enabled by default
# Using config: /root/zookeeper363_02/bin/../conf/zoo.cfg
# Client port found: 2282. Client address: localhost. Client SSL: false.
# Mode: leader
sh ~/zookeeper363_03/bin/zkServer.sh status
# ZooKeeper JMX enabled by default
# Using config: /root/zookeeper363_03/bin/../conf/zoo.cfg
# Client port found: 2283. Client address: localhost. Client SSL: false.
# Mode: follower