Kafka in supervisor mode

2019-08-02 17:54发布

I'm trying to run kafka in supervision mode so that it can start automatically in case of a shutdown. But all the examples of running kafka use shell scripts and the supervisord is not able to note which PID to monitor. Can anyone suggesthow to accomplish auto restart of kafka?

2条回答
劫难
2楼-- · 2019-08-02 18:30

We are running Kafka under Supervisord (http://supervisord.org/), it works like a charm. Run command looks like this (as specified in supervisord.conf file:

command=/usr/local/bin/pidproxy /var/run/kafka.pid /usr/lib/kafka/bin/kafka-server.sh -f -p /var/run/kafka.pid

Flag -f tells Kafka to start in foreground. If flag -p is set, Kafka process PID is written into specified file.

The command pidproxy is a part of Supervisord distribution. Upon receiving KILL signal, it reads PID from specified file, and forwards the signal to the corresponding process.

查看更多
手持菜刀,她持情操
3楼-- · 2019-08-02 18:35

If you are on a Unix or Linux machine, then this is when /etc/inittab comes in handy. Or you might want to use daemontools. I don't know about Windows though.

查看更多
登录 后发表回答