大数据Zookeeper系列之Zookeeper服务开机自启动配置

1.  编写运行脚本

$ sudo cd /etc/init.d
$ sudo vi zookeeper

#!/bin/bash
#chkconfig:2345 20 90
#description:zookeeper
#processname:zookeeper
su - hadoop <<!
case $1 in
start)
sh /opt/apache/zookeeper/zookeeper-3.4.13/bin/zkServer.sh start
;;
stop)
sh /opt/apache/zookeeper/zookeeper-3.4.13/bin/zkServer.sh stop
;;
status)
sh /opt/apache/zookeeper/zookeeper-3.4.13/bin/zkServer.sh status
;;
restart)
sh /opt/apache/zookeeper/zookeeper-3.4.13/bin/zkServer.sh restart
;;
*) 
echo "Usage:$0(start|stop|status|restart)" 
;;
esac
exit
!

2.  赋予权限

$ sudo chmod +x zookeeper 

3.  设置zookeeper服务开机自启动

$ sudo chkconfig --add zookeeper

4.  查看zookeeper服务

$ chkconfig --list zookeeper

©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页