一、先安装jdk
jdk 路径为/usr/local/java
二、再安装zookeeper
zk路径为/use/local/zookeeper
三、创建zookeeper脚本
cd /etc/rc.d/init.d/vim zookeeper # 添加如下脚本#!/bin/bashZK_PATH=/usr/local/zookeeperexport JAVA_HOME=/usr/local/javacase $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
保存
#将脚本注册为servicechkconfig --add zookeeper # 查看chkconfig --list
四、zk 操作
#启动service zookeeper start#停止service zookeeper stop#重新启动service zookeeper restart # 查看状态service zookeeper status