1、解压zookeeper-3.4.6.tar.gz
tar -xvf zookeeper-3.4.6.tar.gz
cp -R zookeeper-3.4.6 /data/zookeeper-2181
2、新建数据存储目录
mkdir -p /data/zookeeper-data
3、修改配置
cd /data/zookeeper-2181/conf
cp zoo_sample.cfg zoo.cfg1
修改数据存储目录地址将dataDir=/tmp/zookeeper修改为dataDir=/data/zookeeper-data
2)在最后加上以下配置(IP地址为各节点的IP地址,单机部署删除最后两个节点即可)
server.1=192.168.131.13:2888:3888
server.2=192.168.131.14:2888:3888
server.3=192.168.131.19:2888:3888
3)写入唯一标识(各台节点分别写入对应标识
server.1上echo '1'>/data/zookeeper-data/myid
server.2上echo '2'>/data/zookeeper-data/myid
server.3上echo '3'>/data/zookeeper-data/myid
4、启动服务./zookeeper-2181/bin/zkServer.sh start
5、服务调用zookeeper://192.168.131.13:2181?backup=192.168.131.14:2181,192.168.131.19:2181