根据Kafka in supervisor mode的回答,我试图做同样的事情。事实是,我的kafka(版本0.8.1.1)似乎打包了不同的运行脚本。所以我试图改编并制作了以下的supervisord配置:
[program:kafka]
command=pidproxy /var/run/kafka.pid /opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
user=kafka
autostart=true
autorestart=true
startsecs=10
startretries=999
log_stdout=true
log_stderr=true
logfile=/var/log/kafka/supervisord-kafka.out
logfile_maxbytes=20MB
logfile_backups=10
我使用以下rpm的supervisor:
[root@dev-xxx yyy]# rpm -qi supervisor
Name : supervisor Relocations: (not relocatable)
Version : 3.0 Vendor: obs://build.opensuse.org/home:presbrey
Release : 13.1 Build Date: Thu 13 Jun 2013 08:35:40 AM IDT
停止监督守护进程并没有杀死卡夫卡见下文:
[root@dev-xxx yyy]# jps
3236 core
31378 QuorumPeerMain
31408 Jps
2964 Kafka
31293 supervisor
31246 nimbus
[root@dev-xxx yyy]# supervisorctl status
kafka RUNNING pid 2963, uptime 1 day, 5:15:18
storm-nimbus RUNNING pid 31246, uptime 0:02:06
storm-supervisor RUNNING pid 31293, uptime 0:01:44
storm-ui RUNNING pid 3236, uptime 5 days, 22:37:33
storm-zookeeper RUNNING pid 31378, uptime 0:00:47
[root@dev-xxx yyy]# service supervisord stop
Stopping supervisord: Shut down
Waiting roughly 60 seconds for /var/run/supervisord.pid to be removed after child processes exit
Supervisord exited as expected in under 12 seconds
[root@dev-xxx yyy]# supervisorctl status
unix:///var/tmp/supervisor.sock no such file
[root@dev-xxx yyy]# jps
2964 Kafka
31474 Jps
答案 0 :(得分:6)
好吧,正如我之前所说stopasgroup=true
应该有所帮助。我不是百分之百确定原因,但根据我的理解,这是因为kafka是由shell脚本启动的,默认情况下,拆除时只会杀死该脚本。