Zookeeper开机启动

1、用cd 命令切换到/etc/rc.d/init.d/目录下

[[email protected] ~]# cd /etc/rc.d/init.d

2、用touch zookeeper创建一个文件

[[email protected] init.d]# touch zookeeper

3、添加可执行权限

[[email protected] init.d]# chmod +x zookeeper

4、编辑zookeeper这个文件,添加以下内容

[[email protected] init.d]# vi zookeeper
#!/bin/bash
#chkconfig:2345 20 90
#description:zookeeper
#processname:zookeeper
case $1 in
  start) su root /usr/local/java/zookeeper-3.4.5/bin/zkServer.sh start;;
  stop) su root /usr/local/java/zookeeper-3.4.5/bin/zkServer.sh stop;;
  status) su root /usr/local/java/zookeeper-3.4.5/bin/zkServer.sh status;;
  restart) su root /usr/local/java/zookeeper-3.4.5/bin/zkServer.sh restart;;
  *) echo "require start|stop|status|restart" ;;
esac

5、使用wq保存并退出

6、启动/停止zookeeper服务

[[email protected] init.d]# service zookeeper start
JMX enabled by default
Using config: /usr/local/java/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

7、把zookeeper添加到开机启动里面

[[email protected] init.d]# chkconig --add zookeeper


» 本文链接:https://blog.java-zone.org/archives/530.html
» 转载请注明来源:Java地带  » 《Zookeeper开机启动》

» 本文章为Java地带整理创作,欢迎转载!转载请注明本文地址,谢谢!
» 部分内容收集整理自网络,如有侵权请联系我删除!

» 订阅本站:https://blog.java-zone.org/feed/

标签: Zookeeper

添加新评论