一、先安装jdk
jdk 路径为/usr/local/java
二、再安装zookeeper
zk路径为/use/local/zookeeper
三、创建zookeeper脚本
cd /etc/rc.d/init.d/ vim zookeeper # 添加如下脚本 #!/bin/bash ZK_PATH=/usr/local/zookeeper export JAVA_HOME=/usr/local/java case $1 in start) sh $ZK_PATH/bin/zkServer.sh start;; stop) sh $ZK_PATH/bin/zkServer.sh stop;; status) sh $ZK_PATH/bin/zkServer.sh status;; restart) sh $ZK_PATH/bin/zkServer.sh restart;; *) echo "require start|stop|status|restart" ;; esac
保存
#将脚本注册为service chkconfig --add zookeeper # 查看 chkconfig --list
四、zk 操作
#启动
service zookeeper start
#停止
service zookeeper stop
#重新启动
service zookeeper restart
# 查看状态
service zookeeper status