簡體   English   中英

如何通過systemd管理kafka經紀人?

[英]how to manage kafka broker by systemd?

我正在嘗試通過systemd來管理kafka經紀人。 這是一個單位文件:

[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 kafka@0.servicesystemctl --user start kafka@1.service

但是,當我嘗試通過systemctl --user stop kafka@0.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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM