我試圖在生產中運行芹菜和芹菜。在我當前的django應用程序中,我可以使用命令「celery -A Gorgon worker」和「celery -A Gorgon擊敗-l debug -max-interval = 10」來測試和運行。另外,我通過virtualenv運行它。另外,我使用redis作爲任務代理。芹菜不生產
整個應用程序運行在一個gunicorn服務器上。但是,當我嘗試對進程進行守護進程時,它會因111連接錯誤而失敗。
我從https://github.com/celery/celery/tree/3.0/extra/generic-init.d添加所需的腳本到/etc/init.d目錄
至於在/ etc /默認腳本,它們看起來像這樣:
我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="/home/ubuntu/sites/virtualenv/bin/celery"
# App instance to use
# comment out this line if you don't use an app
CELERY_APP="Gorgon"
# or fully qualified:
#CELERY_APP="proj.tasks:app"
# Where to chdir at start.
CELERYD_CHDIR="/home/ubuntu/sites/source"
# 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.log"
CELERYD_PID_FILE="/var/run/celery/%N.pid"
# Workers should run as an unprivileged user.
# You need to create this user manually (or you can choose
# a user/group combination that already exists, e.g. nobody).
#CELERYD_USER="celery"
#CELERYD_GROUP="celery"
# If enabled pid and log directories will be created if missing,
# and owned by the userid/group configured.
CELERY_CREATE_DIRS=1
我celerybeat腳本是
# Absolute or relative path to the 'celery' command:
CELERY_BIN="/home/ubuntu/sites/virtualenv/bin/celery"
#CELERY_BIN="/virtualenvs/def/bin/celery"
# App instance to use
# comment out this line if you don't use an app
CELERY_APP="Gorgon"
# or fully qualified:
#CELERY_APP="proj.tasks:app"
# Where to chdir at start.
CELERYBEAT_CHDIR="/home/ubuntu/sites/source"
# Extra arguments to celerybeat
#CELERYBEAT_OPTS="--schedule=/var/run/celery/celerybeat-schedule"
它是如何讓我的芹菜安裝程序作爲一個守護進程運行使用我當前的虛擬env在/ home/ubuntu/sites/virtualenv
爲什麼不使用'supervisor'? – itzMEonTV
'CELERYBEAT_CHDIR =/path/to/project /'? – itzMEonTV
「/ home/ubuntu/sites/source」是項目所在的目錄。即manage.py位於源文件夾內。 –