tar -zxf zookeeper-3.4.6.tar.gz -C /opt/apps/ 解压到指定目录
dataDir=/opt/data/zookeeper # the port at which the clients will connect clientPort=2181 # the maximum number of client connections. #autopurge.purgeInterval=1 server.1=doitedu01:2888:3888 server.2=doitedu02:2888:3888 server.3=doitedu03:2888:3888
# 在doitedu01上 mkdir -p /opt/data/zookeeper;echo 1 > /opt/data/zookeeper/myid
# 在doitedu02上 mkdir -p /opt/data/zookeeper;echo 2 > /opt/data/zookeeper/myid
# 在doitedu03上 mkdir -p /opt/data/zookeeper;echo 3 > /opt/data/zookeeper/myid
export ZK_HOME=/opt/apps/zookeeper-3.4.6/ export PATH=$PATH:$ZK_HOME/bin
vi bin/zkall.sh
#!/bin/bash if [ $# -eq 0 ] then echo "please input param: start stop" else for i in {1..3} do echo "${i}ing doitedu0${i}" ssh doitedu0${i} "source /etc/profile;/opt/apps/zookeeper-3.4.6/bin/zkServer.sh ${1}" done if [ $1 = start ] then sleep 3 for i in {1..3} do echo "checking doitedu0${i}" ssh doitedu0${i} "source /etc/profile;/opt/apps/zookeeper-3.4.6/bin/zkServer.sh status" done fi fi
chmod +x bin/zkall.sh
[root@doitedu01 apps]# scp -r zookeeper-3.4.6/ doitedu02:$PWD [root@doitedu01 apps]# scp -r zookeeper-3.4.6/ doitedu03:$PWD