配置Kafka的Systemctl启动

查看system  ctl 方式配置

https://www.jianshu.com/p/7fd8b6ea336e

systemctl list-unit-files --type=service|grep kafka

kafka systemctl 启动方式命令

systemctl start kafka.service

systemctl stop kafka.service

systemctl start zookeeper.service

systemctl stop zookeeper.service

操作步骤

1、修改KafkaStart.sh、zkStart.sh 、zkStop.sh、zkStart.sh,将相对路径改为绝对路径。

2、修改kafkaStart.sh。去掉JMXPORT属性,放到Kafka-Server-Start.sh

 3、去掉KafkaStart.sh中的kafkamanager启动命令,单独启动。

4、配置开机启动

注:KafkaStart.sh、zkStart.sh 、zkStop.sh、zkStart.sh 为自己编写的快速启动脚本,主要是将原生命令做了次封装。

systemctl enable zookeeper

systemctl  enable  kafka

● zookeeper.service - zookeeper

   Loaded: loaded (/usr/lib/systemd/system/zookeeper.service; static; vendor preset: disabled)

   Active: failed (Result: exit-code) since Tue 2019-11-19 19:06:40 CST; 26s ago

  Process: 96869 ExecStart=/usr/bin/sh /opt/kafka10/zkStart.sh (code=exited, status=127)

相关脚本

Zookeeper

[Unit]

Description=zookeeper

After=network.target

[Service]

Type=forking

ExecStart=/usr/bin/sh /opt/kafka10/zkStar

ExecStop=/usr/bin/sh /opt/kafka10/zkStop.sh

PrivateTmp=true

User=root

Group=root

Kafka

[Unit]

Description=kafka

After=network.target

[Service]

Type=forking

ExecStart=/usr/bin/sh /opt/kafka10/kafkaStart.sh

ExecStop=/usr/bin/sh /opt/kafka10/kafkaStop.sh

PrivateTmp=true

User=root

Group=root

相关推荐