CentOS 7 zookeeper service 开机自启
[Unit]Description=zookeeper.serviceAfter=network.target[Service]Type=forkingEnvironment=/home/jiankunking/zookeeperExecStart=/home/jiankunking/zookeeper/bin/zkServer.sh startExecStop=/home/jian...
·
先安装JDK(yum安装也可以,不需要配置JAVA_HOME)
在/etc/systemd/system目录下创建zookeeper.service文件
[Unit]
Description=zookeeper.service
After=network.target
[Service]
Type=forking
Environment=/home/jiankunking/zookeeper
ExecStart=/home/jiankunking/zookeeper/bin/zkServer.sh start
ExecStop=/home/jiankunking/zookeeper/bin/zkServer.sh stop
ExecReload=/home/jiankunking/zookeeper/bin/zkServer.sh restart
[Install]
WantedBy=multi-user.target
重新加载服务
systemctl daemon-reload
重新加载配置信息:systemctl daemon-reload
启动zookeeper:systemctl start zookeeper.service
关掉zookeeper:systemctl stop zookeeper.service
查看进程状态及日志:systemctl status zookeeper.service
开机自启动:systemctl enable zookeeper.service
关闭自启动:systemctl disable zookeeper.service
查看zk的状态命令(可以看到当前节点是follower还是leader):
bin/zkServer.sh status
个人微信公众号:
作者:jiankunking 出处:http://blog.csdn.net/jiankunking
更多推荐
已为社区贡献21条内容
所有评论(0)