logo  

运维备忘录

运维备忘录
作者: 陈安廉

摘要:软件开发进阶系列


zookeeper


2022-06-09 17:04:06

安装下载:

下载最新稳定版

https://zookeeper.apache.org/releases.html




https://www.runoob.com/w3cnote/zookeeper-setup.html



https://blog.csdn.net/qq_46548855/article/details/113006147




开机启动


http://t.zoukankan.com/javaite-p-8710298.html


vim /etc/systemd/system/zookeeper.service


[Unit]
Description=ZooKeeper Service
After=network.target
After=syslog.target

[Service]
Environment=ZOO_LOG_DIR=/usr/local/zk/apache-zookeeper-3.7.1-bin/logs
SyslogIdentifier=zookeeper

Type=forking
ExecStart=/usr/local/zk/apache-zookeeper-3.7.1-bin/bin/zkServer.sh start /usr/local/zk/apache-zookeeper-3.7.1-bin/conf/zoo.cfg
ExecStop=/usr/local/zk/apache-zookeeper-3.7.1-bin/bin/zkServer.sh stop /usr/local/zk/apache-zookeeper-3.7.1-bin/conf/zoo.cfg
ExecReload=/usr/local/zk/apache-zookeeper-3.7.1-bin/bin/zkServer.sh restart /usr/local/zk/apache-zookeeper-3.7.1-bin/conf/zoo.cfg

[Install]
WantedBy=default.target


[Unit]
Description=ZooKeeper Service
After=network.target
After=syslog.target

[Service]
Environment=ZOO_LOG_DIR=/opt/zk/apache-zookeeper-3.6.3-bin/logs
SyslogIdentifier=zookeeper

Type=forking
ExecStart=/opt/zk/apache-zookeeper-3.6.3-bin/zkServer.sh start /opt/zk/apache-zookeeper-3.6.3-bin/conf/zoo.cfg
ExecStop=/opt/zk/apache-zookeeper-3.6.3-bin/zkServer.sh stop /opt/zk/apache-zookeeper-3.6.3-bin/conf/zoo.cfg
ExecReload=/opt/zk/apache-zookeeper-3.6.3-bin/zkServer.sh restart /opt/zk/apache-zookeeper-3.6.3-bin/conf/zoo.cfg

[Install]
WantedBy=default.target

重新加载配置信息: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