zookeeper设置开机启动项

进入/etc/systemd/system目录

创建zookeeper.service文件

[Unit]
Description=Zookeeper
Requires=network.target
After=network.target

[Service]
Type=forking
Environment=JAVA_HOME=/opt/soft/jdk1.8
WorkingDirectory=/opt/soft/zookeeper-3.4.6
ExecStart=/opt/soft/zookeeper-3.4.6/bin/zkServer.sh start /opt/soft/zookeeper-3.4.6/conf/zoo.cfg
ExecStop=/opt/soft/zookeeper-3.4.6/bin/zkServer.sh stop /opt/soft/zookeeper-3.4.6/conf/zoo.cfg
ExecReload=/opt/soft/zookeeper-3.4.6/bin/zkServer.sh restart /opt/soft/zookeeper-3.4.6/conf/zoo.cfg
Restart=always
RestartSec=10
TimeoutSec=360

[Install]
WantedBy=multi-user.target

启动 zookeeper

systemctl daemon-reload
systemctl start zookeepersystemctl daemon-reload

加入开机启动

systemctl enable zookeeper

检查是否已经开机启动

systemctl is-enabled zookeeper

机器重启验证自启动

 

reboot

 

上一篇:Zookeeper学习视频心得(一)zookeeper特点、数据结构、本地安装、基操


下一篇:maven配置过程