系统:CentOS 7 64位
软件准备:zookeeper-3.4.6.tar.gz、JDK(自行安装,这里不进行描述)
配置环境:一台虚拟机,配置三个节点
三个节点分配目录:
/home/hadoop/zookeeper/zookeeper0
/home/hadoop/zookeeper/zookeeper1
/home/hadoop/zookeeper/zookeeper2
以下为配置过程
一、第一个节点 /home/hadoop/zookeeper/zookeeper0
1. 解压zookeeper-3.4.6.tar.gz
tar -zxvf zookeeper-3.4.6.tar.gz
2.重命名/home/hadoop/zookeeper/zookeeper0/conf下的zoo_sample.cgf
cp /home/hadoop/zookeeper/zookeeper0/conf/zoo_sample.cfg /home/hadoop/zookeeper/zookeeper0/conf/zoo.cfg
3.修改zoo.cfg里的配置内容为
tickTime=2000
initLimit=5
syncLimit=2
dataDir=/home/hadoop/zookeeper/zookeeper0/data
dataLogDir=/home/hadoop/zookeeper/zookeeper0/logs
clientPort=2181
server.0=127.0.0.1:8880:7770
server.1=127.0.0.1:8881:7771
server.2=127.0.0.1:8882:7772
4.复制/home/hadoop/zookeeper/zookeeper0 为/home/hadoop/zookeeper/zookeeper1、/home/hadoop/zookeeper/zookeeper2
cp -r /home/hadoop/zookeeper/zookeeper0 /home/hadoop/zookeeper/zookeeper1
cp -r /home/hadoop/zookeeper/zookeeper0
/home/hadoop/zookeeper/zookeeper2
5.修改zookeeper1、zookeeper2的zoo.cfg配置