14.18. zookeeper
14.18.1. 集群安装
修改所有节点的hosts文件:
10.196.126.23 zookeeper-1
10.196.126.24 zookeeper-2
10.196.126.25 zookeeper-3
cd /root/
tar zxvf apache-zookeeper-3.8.4-bin.tar.gz
cd apache-zookeeper-3.8.4
修改配置文件
cp conf/zoo_sample.cfg conf/zoo.cfg
vim zoo.cfg
三个节点的zoo.cfg都配置成下面的样子:
tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181
initLimit=5
syncLimit=2
server.1=zookeeper-1:2888:3888
server.2=zookeeper-2:2888:3888
server.3=zookeeper-3:2888:3888
mkdir -p /var/lib/zookeeper
分别到每个节点上的zk的数据目录下创建myid文件:
注意要替换myid中的数字
echo "1" > /var/lib/zookeeper/myid
echo "2" > /var/lib/zookeeper/myid
echo "3" > /var/lib/zookeeper/myid
启动zk:
bin/zkServer.sh start