永洪社区

标题: <永洪tech>设置zookeeper开机自启 [打印本页]

作者: Kevinli    时间: 2018-12-26 16:43
标题: <永洪tech>设置zookeeper开机自启
第一步:使用vim /etc/rc.d/rc.local

[root@localhost Desktop]# vim /etc/rc.d/rc.local


第二步:查找JDK的安装目录

[root@localhost Desktop]# which java
/usr/bin/java
[root@localhost Desktop]# ls -lrt /usr/bin/java
lrwxrwxrwx. 1 root root 22 Oct 20 09:36 /usr/bin/java -> /etc/alternatives/java
[root@localhost Desktop]# ls -lrt /etc/alternatives/java
lrwxrwxrwx. 1 root root 46 Oct 20 09:36 /etc/alternatives/java -> /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
[root@localhost Desktop]#
得到jdk的安装目录:/usr/lib/jvm/jre-1.8.0-openjdk.x86_64

第三步:查找zookeeper的安装目录



zookeeper的安装目录:/root/zookeeper-3.4.6/bin

zookeeper的安装目录相信大家应该都能找到。

第四步:添加参数

#!/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/lib/jvm/jre-1.8.0-openjdk.x86_64
/root/zookeeper-3.4.6/bin/zkServer.sh start

好了,到这就完成了,大家可以重启Linux看看检查是否自启成功。


作者: 送你一朵小花花    时间: 2023-2-18 15:59
学到了




欢迎光临 永洪社区 (http://club.yonghongtech.com/) Powered by Discuz! X3.4