使用supervisor在服务器端部署celery

## 1.安装supervisor

pip install supervisor

## 2.echo_supervisord_conf命令得到supervisor配置模板,打开终端执行如下Linux shell命令:
echo_supervisord_conf > supervisord.conf

## 3.vim命令打开该文件并编辑:
vim supervisord.conf

## 4.supervisord.conf在最后一行添加内容:
[program:celery.worker]
;指定运行目录
directory=/home/xxx/xxx/project/
;运行目录下执行命令
command=celery -A xxx.celery_tasks.tasks:celery worker -l info -B

;启动设置
numprocs=1 ;进程数
autostart=true ;当supervisor启动时,程序将会自动启动
autorestart=true ;自动重启

;停止信号,默认TERM
;中断:INT (类似于Ctrl+C)(kill -INT pid),退出后会将写文件或日志(推荐)
;终止:TERM (kill -TERM pid)
;挂起:HUP (kill -HUP pid),注意与Ctrl+Z/kill -stop pid不同
;从容停止:QUIT (kill -QUIT pid)
stopsignal=INT

## 4.启动supervisor:
supervisord -c supervisord.conf

## 5.关闭supervisord需要通过supervisor的控制器:
supervisorctl -c supervisord.conf shutdown

## 6.重启supervisord也是通过supervisor的控制器
supervisorctl -c supervisord.conf reload

转载于:https://www.cnblogs.com/debochan/p/10823984.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值