zookeeper实现开机自启动
常用方式:
1、首先安装好jdk
2、直接修改/etc/rc.d/rc.local文件
在/etc/rc.d/rc.local文件中需要输入两行,其中export JAVA_HOME=/usr/java/jdk1.8.0_112是必须的,否则开机启动不成功,大家根据自己JDK实际安装的位置自行修改。另外一行/usr/local/zookeeper-3.4.5/bin/zkServer.sh start则是我们zookeeper的启动命令。
[root@zookeeper ~]# sudo vim /etc/rc.d/rc.local
#!/bin/sh
This script will be executed after all the other init scripts.
You can put your own initialization stuff in here if you don’t
want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
export JAVA_HOME=/usr/java/jdk1.8.0_112
/usr/local/zookeeper-3.4.5/bin/zkServer.sh start