按照此处的说明,我将脚本从github复制到/etc/init.d/celeryd,然后使其可执行;
$ ll /etc/init.d/celeryd
-rwxr-xr-x 1 root root 9481 Feb 19 11:27 /etc/init.d/celeryd*
Run Code Online (Sandbox Code Playgroud)
我按照说明创建了配置文件/ etc/default/celeryd:
# Names of nodes to start
# most will only start one node:
#CELERYD_NODES="worker1"
# but you can also start multiple and configure settings
# for each in CELERYD_OPTS (see `celery multi --help` for examples).
CELERYD_NODES="worker1 worker2 worker3"
# Absolute or relative path to the 'celery' command:
CELERY_BIN="/usr/local/bin/celery"
#CELERY_BIN="/virtualenvs/def/bin/celery"
# App instance to use
# comment out …Run Code Online (Sandbox Code Playgroud) 我将 celeryd 和 celerybeat 设置为守护进程,它们工作了不久。但从一段时间以来,它不会启动工作程序,也不会创建 pid 文件。
这是我的/etc/default/celeryd:
# Name of nodes to start
CELERYD_NODES="w1 w2 w3 w4 w5 w6 w7 w8"
# Extra arguments to celeryd
CELERYD_OPTS="--time-limit=300 --concurrency=8"
# Where to chdir at start.
CELERYD_CHDIR="/srv/www/web-system/myproject"
# %n will be replaced with the nodename.
#CELERYD_LOG_FILE="/var/log/celery/%n.log"
#CELERYD_PID_FILE="/var/run/celery/%n.pid"
CELERYD_LOG_FILE="/srv/www/web-system/logs/celery/%n.log"
CELERYD_PID_FILE="/srv/www/web-system/pids/celery/%n.pid"
# Log level to use for celeryd. Default is INFO.
CELERYD_LOG_LEVEL="INFO"
# How to call "manage.py celeryd_multi"
CELERYD_MULTI="$CELERYD_CHDIR/manage.py celeryd_multi"
# How to call "manage.py celeryctl"
CELERYCTL="$CELERYD_CHDIR/manage.py celeryctl"
# Workers should …Run Code Online (Sandbox Code Playgroud)