ZooKeeper开机启动的俩种方式

两种方式可以实现开机自启动

第一种:直接修改/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 ~]# 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
发布了116 篇原创文章 · 获赞 83 · 访问量 28万+

猜你喜欢

转载自blog.csdn.net/belvine/article/details/95047311
今日推荐