kafka 0.8.1.1 under supervision(supervisord)在停止supervisord守护进程时不会被杀死

ijxebb2r  于 2021-06-07  发布在  Kafka
关注(0)|答案(1)|浏览(445)

按照Kafka的回答,我也试着这样做。问题是,我的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的管理器:

[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

停止supervisord守护进程不会杀死kafka,请参见以下内容:

[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
yx2lnoni

yx2lnoni1#

嗯,就像我刚才说的 stopasgroup=true 应该有帮助。我不能百分之百确定确切的原因,但从我的理解,这是因为Kafka是由shell脚本启动的,默认情况下,在拆掉时,只有那个脚本会被杀死。

相关问题