码迷,mamicode.com
首页 > 其他好文 > 详细

设置zookeeper开机自启动

时间:2018-01-20 19:49:49      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:col   esc   ram   roo   $1   zook   res   3.4   chm   

1.进入到/etc/init.d目录下,新建一个zookeeper脚本

cd /etc/init.d

vi zookeeper

#!/bin/bash    
#chkconfig:2345 20 90    
#description:zookeeper    
#processname:zookeeper    
export JAVA_HOME=/usr/local/programs/jdk1.8
case $1 in    
        start) su root /usr/local/programs/zookeeper-3.4.10/bin/zkServer.sh start;;    
        stop) su root /usr/local/programs/zookeeper-3.4.10/bin/zkServer.sh stop;;    
        status) su root /usr/local/programs/zookeeper-3.4.10/bin/zkServer.sh status;;    
        restart) su root /usr/local/programs/zookeeper-3.4.10/bin/zkServer.sh restart;;    
        *) echo "require start|stop|status|restart" ;;    
esac

 

2.给脚本添加执行权限
chmod +x zookeeper

[root@TestServer-DFJR bin]# cd /etc/init.d
[root@TestServer-DFJR init.d]# chmod +x zookeeper

 

3.使用service zookeeper start/stop命令来尝试启动关闭zookeeper,使用service zookeeper status查看zookeeper状态。
或者直接 zookeeper start/stop/status

 

4.添加到开机启动

[root@TestServer-DFJR init.d]# chkconfig --add zookeeper

 

5.查看开机自启的服务中是否已经有我们的zookeeper

[root@TestServer-DFJR init.d]# chkconfig --list zookeeper
zookeeper          0:off    1:off    2:on    3:on    4:on    5:on    6:off

 

设置zookeeper开机自启动

标签:col   esc   ram   roo   $1   zook   res   3.4   chm   

原文地址:https://www.cnblogs.com/zsg88/p/8321638.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!