zoukankan      html  css  js  c++  java
  • 配置zookeeper开机自启动

    第一种、修改vim /etc/rc.local文件

    vim /etc/rc.local

    加入:

    export JAVA_HOME=/usr/local/JAVA/  --JDK安装路径
    /data/zookeeper-3.4.11/bin/zkServer.sh start

    重启后生效

    第二种、建立zookeeper服务

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

    vim /etc/init.d/zookeeper

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

    2、添加执行权限

    chmod +x /etc/init.d/zookeeper

    3、service zookeeper start/stop/status命令启动、停止或查看状态

    4、添加到开机自启

    chkconfig  --add zookeeper

  • 相关阅读:
    1036 商务旅行
    4165 ​高精度求阶乘
    3117 高精度练习之乘法
    封装代理
    freemarker写select组件(三)
    VC双缓冲画图技术介绍
    JS学习十七天----工厂方法模式
    Struts2 全局结果集
    HDU 1730 Northcott Game
    C++ STL:vector
  • 原文地址:https://www.cnblogs.com/xiaoxitest/p/10095771.html
Copyright © 2011-2022 走看看