Lebear
If you don't like the world, create one instead of complaining.

centos 7 如何添加zookeeper自启动服务

2020-02-04
Word count: 167 | Reading time: 1min
1
$ vim zookeeper    # 编辑一个shell脚本,如果没有安装vim可用nano,vi等代替vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
内容如下:

#!/bin/bash
#chkconfig:2345 20 90
#description:zookeeper
#processname:zookeeper
export JAVA_HOME=/usr/java/default
case $1 in
start) su - zookeeper -c '/usr/local/zookeeper-3.4.5/bin/zkServer.sh start';;
stop) su - zookeeper -c '/usr/local/zookeeper-3.4.5/bin/zkServer.sh stop';;
status) su - zookeeper -c '/usr/local/zookeeper-3.4.5/bin/zkServer.sh status';;
restart) su - zookeeper -c '/usr/local/zookeeper-3.4.5/bin/zkServer.sh restart';;
*) echo "require startstopstatusrestart" ;;
esac

注意:JAVA_HOME 路径要根据自己的来; zookeeper的路径也要根据自己的来;


使用方法:

启动:service zookeeper start

停止:service zookeeper stop

查看状态:service zookeeper status

重启服务:service zookeeper restart

Author: Leisurelybear

Link: https://blog.lebear.top/2020/02/04/16/

Copyright: Copyright © 2019-2022 LeisurelyBear All rights reserved.

< PreviousPost
Linux下网易云音乐打开无反应
NextPost >
商城项目中踩到的坑(Hadoop、Kafka、Zookeeper、redis、hbase、Mysql)
CATALOG