zookeeper设置开机自启

Posted 日常笔记

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zookeeper设置开机自启相关的知识,希望对你有一定的参考价值。

开机自启:
(1)编辑zookeeper.service文件

    vim /usr/lib/systemd/system/zookeeper.service

    加入如下内容

复制代码
[Unit]
Description=zookeeper
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/zookeeper/zookeeper-3.4.12/bin/zkServer.sh start
ExecReload=/usr/local/zookeeper/zookeeper-3.4.12/bin/zkServer.sh restart
ExecStop=/usr/local/zookeeper/zookeeper-3.4.12/bin/zkServer.sh stop
[Install]
WantedBy=multi-user.target
复制代码
  (2)生效

    systemctl daemon-reload

  (3)改变文件权限

    chmod 777 /usr/lib/systemd/system/zookeeper.service

  (4)systemctl开机启动zookeeper

    systemctl enable /usr/lib/systemd/system/zookeeper.service

    或

    systemctl enable /usr/lib/systemd/system/zookeeper

  (5)查看是否开机启动

    systemctl is-enabled zookeeper.service

  (6)systemctl取消开机启动redis

    systemctl disable zookeeper.service

以上是关于zookeeper设置开机自启的主要内容,如果未能解决你的问题,请参考以下文章

电脑设置开机自启软件的方法详解

设置nginx开机自启

openwrt不能自启插件原因

Ubuntu20.04设置开机自启脚本开机自启命令(ubuntu自启,ubuntu开机自启)rc(run command)(systemd)(/etc/rc.local)(开机启动原理)开机自启动

设置防火强开机自启,以及没有成功的tomcat开机自启

Ubuntu20.04设置开机自启脚本开机自启命令(ubuntu自启,ubuntu开机自启)rc(run command)(systemd)(/etc/rc.local)(开机启动原理)