快捷搜索:  汽车  科技

linux如何卸载zookeeper:CentOS8设置Zookeeper开机启动

linux如何卸载zookeeper:CentOS8设置Zookeeper开机启动[root@centos-160 ~]# jps 1233 QuorumPeerMain 2033 Jps 查看Zookeeper运行状态:[root@centos-160 ~]# chkconfig --list Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular targ

首先,查询JAVA_HOME和ZooKeeper_HOME环境变量,如下所示:

[root@CentOS-160 ~]# echo $JAVA_HOME /usr/java/jdk1.8.0_202 [root@centos-160 ~]# echo $ZOOKEEPER_HOME /usr/local/zookeeper-3.7

然后,按照如下步骤配置Zookeeper系统服务。

linux如何卸载zookeeper:CentOS8设置Zookeeper开机启动(1)

1、创建文件

vim /etc/rc.d/init.d/zookeeper

文件内容如下所示:

#!/bin/bash #chkconfig:2345 20 90 #description:zookeeper #processname:zookeeper export JAVA_HOME=/usr/java/jdk1.8.0_202 case $1 in start) su root /usr/local/zookeeper-3.7/bin/zkServer.sh start;; stop) su root /usr/local/zookeeper-3.7/bin/zkServer.sh stop;; status) su root /usr/local/zookeeper-3.7/bin/zkServer.sh status;; restart) su root /usr/local/zookeeper-3.7/bin/zkServer.sh restart;; *) echo "require start|stop|status|restart" ;; esac2、加可执行权限

chmod x /etc/rc.d/init.d/zookeeper

linux如何卸载zookeeper:CentOS8设置Zookeeper开机启动(2)

3、注册为系统服务

[root@centos-160 ~]# chkconfig --add zookeeper

4、添加开机自启动

[root@centos-160 ~]# chkconfig zookeeper on

5、查看服务列表

[root@centos-160 ~]# chkconfig --list Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular target use 'systemctl list-dependencies [target]'. zookeeper 0:off 1:off 2:on 3:on 4:on 5:on 6:off6、重启验证

重启CentOS,然后执行jps 查看Zookeeper 进程是否运行中:

[root@centos-160 ~]# jps 1233 QuorumPeerMain 2033 Jps

查看Zookeeper运行状态:

[root@centos-160 ~]# service zookeeper status ZooKeeper JMX enabled by default Using config: /usr/local/zookeeper-3.7/bin/../conf/zoo.cfg Client port found: 2181. Client address: localhost. Client SSL: false. Mode: leader

猜您喜欢: