44 lines
1.1 KiB
Markdown
44 lines
1.1 KiB
Markdown
# Celery 广播 Worker(Supervisor)
|
||
|
||
## 服务器安装(一次性)
|
||
|
||
```bash
|
||
apt install -y supervisor
|
||
systemctl enable supervisor && systemctl start supervisor
|
||
|
||
cd /opt/1panel/apps/openresty/nginx/www/sites/43.142.166.152.443/django
|
||
git pull
|
||
|
||
cp deploy/supervisor/celery-broadcast.conf /etc/supervisor/conf.d/celery-broadcast.conf
|
||
supervisorctl reread
|
||
supervisorctl update
|
||
supervisorctl start celery-broadcast
|
||
supervisorctl status celery-broadcast
|
||
```
|
||
|
||
## 验证
|
||
|
||
```bash
|
||
celery -A a_long_dianjing inspect registered | grep dingdan_guangbo
|
||
tail -f /var/log/celery-broadcast.log
|
||
```
|
||
|
||
## 日常
|
||
|
||
```bash
|
||
supervisorctl restart celery-broadcast
|
||
```
|
||
|
||
## 注意
|
||
|
||
- 不要用 `nohup` 再起第二个 celery worker,避免抢任务。
|
||
- 仅 `-Q default`,不会跑订单自动结算(order_tasks)。
|
||
- **禁止** 启动 `celery beat` 或 `-Q order_tasks` 的 worker。
|
||
- 部署后执行一次(清理旧进程):
|
||
```bash
|
||
pkill -f "celery -A a_long_dianjing beat" || true
|
||
pkill -f "celery -A a_long_dianjing worker.*order_tasks" || true
|
||
supervisorctl restart celery-broadcast
|
||
```
|
||
- 密钥文件 `app_secrets.py` 只放服务器,不要提交 Git。
|