【发布时间】:2020-04-15 09:30:53
【问题描述】:
我有一个烧瓶应用程序myapp_A,它使用 celery 来运行一些异步任务。我已经将 celery 配置为作为守护进程运行。这是服务脚本。
/etc/default/celery:
# Name of nodes to start
CELERYD_NODES="w1"
# Absolute or relative path to the 'celery' command:
CELERY_BIN="/var/www/myapp_A.com/public_html/venv/bin/celery"
# App instance to use
CELERY_APP="myapp_A.celery"
# Where to chdir at start.
CELERYD_CHDIR="/var/www/myapp_A.com/public_html/"
# Extra command-line arguments to the worker
CELERYD_OPTS="--time-limit=300 --concurrency=8"
# %n will be replaced with the first part of the nodename.
CELERYD_LOG_FILE="/var/log/celery/%n%I.log"
CELERYD_PID_FILE="/var/run/celery/%n.pid"
CELERYD_LOG_LEVEL="INFO"
# Workers should run as an unprivileged user.
CELERYD_USER="myuser"
CELERYD_GROUP="www-data"
# If enabled pid and log directories will be created if missing,
# and owned by the userid/group configured.
CELERY_CREATE_DIRS=1
/etc/init.d/celeryd:
来自here的Celery的通用之一。
现在我有另一个 Flask 应用 myapp_B 也需要 celery 来运行任务。
- 我应该如何配置?
- 我应该以不同的名称创建另一个守护进程吗?
- 我应该如何为多个 celery 进程配置消息代理 (RabbitMQ)?
【问题讨论】:
标签: flask rabbitmq celery daemon