通过supervisor自启动kafka服务

avatar 2021年6月6日18:11:52 评论 719 次浏览

一、supervisor安装:

[wolf@wulaoer.org 🔥🔥🔥🔥 ]$ yum install supervisor
[wolf@wulaoer.org 🔥🔥🔥🔥 ]$ echo_supervisord_conf > /etc/supervisord.conf

二、生成基础配置:

[wolf@wulaoer.org 🔥🔥🔥🔥 ]$ vi /etc/supervisord.conf
最后添加两行
[include]
files = /etc/supervisor/*.conf

三、创建目录

[wolf@wulaoer.org 🔥🔥🔥🔥 ]$ mkdir /etc/supervisor

四、创建kafka启动文件

[wolf@wulaoer.org 🔥🔥🔥🔥 ]$ vi /etc/supervisor/kafka.conf
[program:kafka]
command=kafka-server-start.sh  /usr/local/kafka/kafka_2.11-1.1.0/config/server.properties
user=root
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/tmp/supervisor_kafka.log
redirect_stderr=true

五、启动supervisor

[wolf@wulaoer.org 🔥🔥🔥🔥 ]$ supervisord -c /etc/supervisord.conf
#查看supervisor是否启动
[wolf@wulaoer.org 🔥🔥🔥🔥 ]$  pgrep supervisord
# 关闭supervisord
[wolf@wulaoer.org 🔥🔥🔥🔥 ]$  supervisorctl shutdown
# 启动
supervisord 或者 supervisord -c 你的supervisord.conf路径
查看是否正常运行
[wolf@wulaoer.org 🔥🔥🔥🔥 ]$  supervisorctl status
#更新新的配置到supervisord
[wolf@wulaoer.org 🔥🔥🔥🔥 ]$  supervisorctl update
# 重新启动配置中的所有程序
[wolf@wulaoer.org 🔥🔥🔥🔥 ]$  supervisorctl reload

# 单机多kafka
[wolf@wulaoer.org 🔥🔥🔥🔥 ]$ /etc/supervisor/kafka1.conf
[program:kafka1]
command=/opt/kafka_2.13-2.4.0/bin/kafka-server-start.sh  /opt/kafka_2.13-2.4.0/config/server.properties1
user=root
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/tmp/supervisor_kafka1.log
redirect_stderr=true

[wolf@wulaoer.org 🔥🔥🔥🔥 ]$  /etc/supervisor/kafka1.conf
[program:kafka2]
command=/opt/kafka_2.13-2.4.0/bin/kafka-server-start.sh  /opt/kafka_2.13-2.4.0/config/server.properties2
user=root
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/tmp/supervisor_kafka2.log
redirect_stderr=true

kafka3.conf同理

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: