kafka zookeeper配置systemctl

工具 0 1804 0 2021-01-01 22:33:19

zookpper配置systemctl

[root@localhost system]# cat zookeeper.service 
[Unit]
Description=The zookeeper server
After=network.target

[Service]
Type=simple
User=root
Group=root
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/bin"
ExecStart=/usr/local/src/kafka_2.11-1.1.1/bin/zookeeper-server-start.sh /usr/local/src/kafka_2.11-1.1.1/config/zookeeper.properties
ExecStop=/usr/local/src/kafka_2.11-1.1.1/bin/zookeeper-server-stop.sh
PrivateTmp=true

[Install]
WantedBy=multi-user.target

kafka的systemctl配置

[Unit]
Description=The kafka server
After=network.target

[Service]
Type=simple
User=root
Group=root
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/bin"
ExecStart=/usr/local/src/kafka_2.11-1.1.1/bin/kafka-server-start.sh /usr/local/src/kafka_2.11-1.1.1/config/server.properties
ExecStop=/usr/local/src/kafka_2.11-1.1.1/bin/kafka-server-stop.sh
PrivateTmp=true

[Install]
WantedBy=multi-user.target

其它命令参考:

systemctl daemon-reload
systemctl enable kafka/zookeeper
systemctl start kafka/zookeeper

报错: systemctl Please remove executable permission bits. service自动文件的权限不对

cd /usr/lib/systemd/system
chmod 644 zookeeper.service

主题切换

颜色:

主题: