supervisor 管理 celery

安装supervisor

[root@ipv6-api ~]# pip3 install  supervisor

生成配置文件

[root@ipv6-api ~]#echo_supervisord_conf > /etc/supervisord.conf

增加如下配置

[include]
files = /var/www/ipv6check/app/api/v1/drive/sv.ini

如下配置

[root@ipv6-api ~]# cat /var/www/ipv6check/app/api/v1/drive/sv.ini
[program:celery]
command=celery -A run worker --loglevel=info        
directory=/var/www/ipv6check/app/api/v1/drive/           #celer方法目录
stdout_logfile=/var/log/celery/check_task_out.log
stderr_logfile=/var/log/celery/check_task_err.log
autorestart=true
redirect_stderr=true
startsecs=10
stopwaitsecs = 600

扫描二维码关注公众号,回复: 5981107 查看本文章

启动服务

[root@ipv6-api ~]#supervisord

更新服务

[root@ipv6-api ~]# supervisorctl update

客户端登录,可以查看到启动状态

[root@ipv6-api ~]# supervisorctl -c /etc/supervisord.conf
celery RUNNING pid 10923, uptime 18:22:35

可以执行以下方法

supervisor> status
celery RUNNING pid 10923, uptime 18:26:55

status 查看状态
reread 读取配置信息
update 加载最新的进程
stop 停止进程
start 启动进程
reload 重新加载配置

猜你喜欢

转载自www.cnblogs.com/menkeyi/p/10754456.html