注意:在使用脚本之前需要安装jdk
#/bin/bash
#keeper install
cd /opt/soft
wget http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
tar xf zookeeper-3.4.10.tar.gz
mv zookeeper-3.4.10 /usr/local/
cd /usr/local
ln -s zookeeper-3.4.10 zookeeper
cd /usr/local/zookeeper/conf/
mv zoo_sample.cfg zoo.cfg
cat >/etc/profile<export ZOOKEEPER_HOME=/usr/local/zookeeper/
export PATH=$ZOOKEEPER_HOME/bin:$PATH
export PATH
EOF

source /etc/profile

#端口号是2181
#启动
cd /usr/local/zookeeper/bin/
./zkServer.sh start

#查看状态
./zkServer.sh status

netstat -lntup
#关闭
#zkServer.sh stop
#重启
#zkServer.sh reload