上周我在我的生产系统上安装了RabbitMQ和Celery,并在我的本地开发中进行了测试,结果都表现良好。Rabbitmq celeryd celerybeat不能执行生产守护进程中的任务
我感觉我的任务没有在生产中执行,因为我有大约1200个任务仍在队列中。
我运行CentOS 5.4安装程序,使用celeryd
和celerybeat
守护程序和WSGI 我已经导入到wsgi模块。
当我运行,/etc/init.d/celeryd start
我得到如下回应
[[email protected] myproject]# /etc/init.d/celeryd start
celeryd-multi v2.3.1
> Starting nodes...
> w1.myvm.centos01: OK
当我运行/etc/init.d/celerybeat start
我得到如下回应
[[email protected] fundedmyprojectbyme]# /etc/init.d/celerybeat start
Starting celerybeat...
因此,通过输出似乎项successully执行 - 尽管在看队列时他们似乎不仅仅是被执行。
现在,如果我执行相同的执行,但是使用django的manage.py而不是./manage.py celeryd
和./manage.py celerybeat
,则立即开始处理任务。
我/etc/default/celeryd
# Where to chdir at start.
CELERYD_CHDIR="/www/myproject/"
# How to call "manage.py celeryd_multi"
CELERYD_MULTI="$CELERYD_CHDIR/manage.py celeryd_multi"
# Extra arguments to celeryd
CELERYD_OPTS="--time-limit=300 --concurrency=8"
# Name of the celery config module.
CELERY_CONFIG_MODULE="celeryconfig"
# %n will be replaced with 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.
CELERYD_USER="celery"
CELERYD_GROUP="celery"
# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="settings"
我/etc/default/celerybeat
# Where the Django project is.
CELERYD_CHDIR="/www/myproject/"
# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="settings"
# Path to celeryd
CELERYD="/www/myproject/manage.py celeryd"
# Path to celerybeat
CELERYBEAT="/www/myproject/manage.py celerybeat"
# Extra arguments to celerybeat
CELERYBEAT_OPTS="--schedule=/var/run/celerybeat-schedule"
我的/etc/init.d文件/ celeryd和/ celerybeat是基于generic scripts
我缺少一个部分配置?
也许是有用的阅读日志如果没有创建日志,你的init脚本应该在/ var/log /上创建,这是因为celery在创建日志文件时有问题。 你的生产系统和你的本地有什么不同? 你确定它们有相同的python版本吗? –