Zookeeper—开机启动
cd /etc/rc.d/init.d/
touch zookeeper
chmod 777 zookeeper
vim zookeeper
#!/bin/bash #chkconfig:2345 20 90 #description:zookeeper #processname:zookeeper export JAVA_HOME=/usr/java/jdk1.8.0_181 export PATH=$JAVA_HOME/bin:$PATH case "$1" in start) /usr/local/zookeeper3.5.7/bin/zkServer.sh start;; stop) /usr/local/zookeeper3.5.7/bin/zkServer.sh stop;; status) /usr/local/zookeeper3.5.7/bin/zkServer.sh status;; restart) /usr/local/zookeeper3.5.7/bin/zkServer.sh restart;; *) echo "require start|stop|status|restart" ;; esac
设置开机启动配置
chkconfig zookeeper on
验证:
chkconfig --add zookeeper
chkconfig --list zookeeper
之后就可以使用 service zookeeper 命令了