Apache kafka 如何通过systemd管理卡夫卡经纪人?

Apache kafka 如何通过systemd管理卡夫卡经纪人?,apache-kafka,systemd,Apache Kafka,Systemd,我正试图通过systemd管理卡夫卡经纪人。这是一个单位文件: [Unit] Description=Kafka with broker id (%i) After=network.target After=zk.service [Service] Type=simple SyslogIdentifier=kafka (%i) WorkingDirectory=/opt/service/kafka_2.11-0.9.0.1 LimitNOFILE=16384:163840 ExecStar

我正试图通过systemd管理卡夫卡经纪人。这是一个单位文件:

[Unit]
Description=Kafka with broker id (%i)
After=network.target
After=zk.service

[Service]
Type=simple

SyslogIdentifier=kafka (%i)
WorkingDirectory=/opt/service/kafka_2.11-0.9.0.1
LimitNOFILE=16384:163840

ExecStart=/usr/bin/bash -c 'bin/kafka-server-start.sh /opt/service/units/kafka/%i.properties'
ExecStop=/usr/bin/bash -c 'bin/kafka-server-stop.sh /opt/service/units/kafka/%i.properties'

[Install]
WantedBy=multi-user.target
有了这个文件,我可以通过命令
systemctl--user start启动kafkakafka@0.service
systemctl——用户启动kafka@1.service

但是当我试图通过
systemctl--user stop杀死这些守护进程时kafka@0.service
,所有两个守护进程都已停止!那么,为什么我不能只杀一个经纪人呢?

类似这样的事情:

[Unit]
Description=Kafka with broker id (%i)
After=network.target
After=zk.service

[Service]
Type=forking

SyslogIdentifier=kafka (%i)
Restart=on-failure
LimitNOFILE=16384:163840

ExecStart=/opt/service/kafka_2.11-0.9.0.1/bin/kafka-server-start.sh -daemon /opt/service/units/kafka/%i.properties

[Install]
WantedBy=multi-user.target
另见(未经测试)