supervisor管理superset
参考:
https://blog.51cto.com/qiangsh/2153185
安装supervisor:
pip install supervisor
停止supervisor管理的服务:
[root@fengfeng1 ~]# cd /data/venv/etc/
[root@fengfeng1 etc]# ls
bash_completion.d supervisord.conf
[root@fengfeng1 etc]# vim supervisord.conf
#注销掉需要停止的服务的配置
#[program:superset]
#command=/data/venv/bin/gunicorn -w 10 -k gevent --timeout 120 -b 0.0.0.0:6666 superset:app
#autostart=true
#startsecs=10
#autorestart=true
#stdout_logfile=/tmp/superset.log
[root@fengfeng1 etc]# /data/venv/bin/supervisorctl status
airflow_scheduler RUNNING pid 7397, uptime 6 days, 18:30:34
airflow_web RUNNING pid 27396, uptime 5 days, 20:48:44
airflow_worker RUNNING pid 5234, uptime 6 days, 18:32:46
superset RUNNING pid 5764, uptime 3 days, 0:05:17
[root@fengfeng1 etc]# /data/venv/bin/supervisorctl update
superset: stopped
superset: removed process group
[root@fengfeng1 etc]# /data/venv/bin/supervisorctl status
airflow_scheduler RUNNING pid 7397, uptime 6 days, 18:31:04
airflow_web RUNNING pid 27396, uptime 5 days, 20:49:14
airflow_worker RUNNING pid 5234, uptime 6 days, 18:33:16
命令行管理:
cd /data/venv/etc
(venv) [root@10-52-56-119 etc]# supervisorctl status
airflow_failover RUNNING pid 27933, uptime 5:37:44
airflow_flower RUNNING pid 27938, uptime 5:37:44
airflow_scheduler RUNNING pid 7698, uptime 1:06:57
airflow_web RUNNING pid 27940, uptime 5:37:44
airflow_worker RUNNING pid 27941, uptime 5:37:44
#可以手动停止某个进程:
supervisorctl stop airflow_scheduler
然后查看它又会起来,因为:
autostart=true
让进程不自动重启,配置文件设置:
autostart=false
坑:
1/ supervisor默认对打开文件数有限制,https://www.cnblogs.com/weifeng1463/p/8422144.html
[program:airflow_scheduler]
command=airflow scheduler
autorestart=true
stopasgroup=true
killasgroup=true
stdout_logfile=/root/airflow/scheduler.log
minfds=100000
minprocs=100000
用include的方式管理bi kafka:
vim /etc/supervisord.conf
[include]
files = supervisord.d/*.ini
bi-kafka1:
[program:kafka1]
directory=/data/kafka-9092/
command=/data/kafka-9092/bin/kafka-server-start.sh /data/kafka-9092/config/server.properties
autostart=true
autorestart=true
startsecs=10
stderr_logfile=/tmp/super_kafka1_stderr.log
stdout_logfile=/tmp/super_kafka1_stdout.log
user=bi-kafka
redirect_stderr=true
stdout_logfile_backups=2
[program:kafka2]
directory=/data/kafka-19092/
command=/data/kafka-19092/bin/kafka-server-start.sh /data/kafka-19092/config/server.properties
autostart=true
autorestart=true
startsecs=10
stderr_logfile=/tmp/super_kafka2_stderr.log
stdout_logfile=/tmp/super_kafka2_stdout.log
user=bi-kafka
redirect_stderr=true
stdout_logfile_backups=2
bi-kafka2:
ls /etc/supervisord.d
jps.ini
cat jps.ini
[program:kafka1]
directory=/data1/kafka/
command=/data1/kafka/bin/kafka-server-start.sh /data1/kafka/config/server.properties
autostart=true
autorestart=true
startsecs=10
stderr_logfile=/tmp/super_kafka1_stderr.log
stdout_logfile=/tmp/super_kafka1_stdout.log
user=bi-kafka
redirect_stderr=true
stdout_logfile_backups=2
[program:kafka2]
directory=/data2/kafka/
command=/data2/kafka/bin/kafka-server-start.sh /data2/kafka/config/server.properties
autostart=true
autorestart=true
startsecs=10
stderr_logfile=/tmp/super_kafka2_stderr.log
stdout_logfile=/tmp/super_kafka2_stdout.log
user=bi-kafka
redirect_stderr=true
stdout_logfile_backups=2