消费者连接错误与django和芹菜+ rabbitmq? [英] Consumer Connection error with django and celery+rabbitmq?

查看:103
本文介绍了消费者连接错误与django和芹菜+ rabbitmq?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用django和rabbit-mq设置celeryd。到目前为止,我已经完成了以下工作:




  • 从pip安装芹菜

  • 已安装rabbitmq

  • 通过rabbitmqctl向rabbitmq添加用户和vhost,以及该用户的权限

  • 启动了rabbitmq-server

  • 通过pip安装django-celery

  • 设置django-celery,包括其表

  • settings.py(BROKER_HOST,BROKER_PORT,BROKER_USER,BROKER_PASSWORD,BROKER_VHOST)中的各种功能,以及导入djecelery,调用安装功能并将其添加到INSTALLED APPS中。我已经检查了两次,所有这些值都是正确的(至少,用户,密码和vhost是正确的)。



所以现在当我运行 python manage.py celeryd -l info 我得到连接错误(见下文)。任何人都知道为什么?

  $ python manage.py celeryd -l info 
/ usr / local / lib / python2.7 / dist-packages / djcelery / loaders.py:108:UserWarning:使用settings.DEBUG导致内存泄漏,从不在生产环境中使用此设置!
warnings.warn(使用settings.DEBUG导致内存泄漏,从不
[2012-05-15 18:38:04,486:警告/ MainProcess]

- ------------- celery @ ubuntu v2.5.3
---- **** -----
--- * *** * - [配置]
- * - **** ---。broker:amqp:// celeryuser @ localhost:5672 / celeryhost
- ** ----------。 loader:djcelery.loaders.DjangoLoader
- ** ----------。logfile:[stderr] @INFO
- ** ----------。并发性:1
- ** ----------。事件:OFF
- *** --- * ---。beat:OFF
- * ****** ----
--- ***** ----- [队列]
--------------。芹菜:交换:芹菜(直接)绑定:芹菜


[任务]


[2012-05-15 18:38:04,562:INFO / poolWorker-1]子进程调用self.run()
[2012-05-15 18:38:04,565:警告/ MainProcess]芹菜@ ubuntu已经启动
[2012-05-15 18 :38:07,572:ERROR / MainProcess]消费者:连接错误:[Errno 104]连接由p复位能效比。再次尝试2秒...
^ C [2012-05-15 18:38:08,434:警告/ MainProcess] celeryd:再次按Ctrl + C将终止所有正在运行的任务!
[2012-05-15 18:38:08,435:警告/ MainProcess] celeryd:热关闭(MainProcess)
[2012-05-15 18:38:09,372:INFO / PoolWorker-1]关闭
[2012-05-15 18:38:09,373:INFO / PoolWorker-1]进程退出与exitcode 0
[2012-05-15 18:38:09,376:INFO / MainProcess]进程关闭


解决方案

您的问题在 BROKER_URL



使用额外的 VHOST ,正确的配置将是:

  BROKER_URL ='amqp:// celeryuser @ localhost:5672 //'
BROKER_VHOST ='/ celeryhost'


I'm trying to set up celeryd with django and rabbit-mq. So far, I've done the following:

  • Installed celery from pip
  • Installed rabbitmq via the debs available from their repository
  • Added a user and vhost to rabbitmq via rabbitmqctl, as well as permissions for that user
  • Started the rabbitmq-server
  • Installed django-celery via pip
  • Set up django-celery, including its tables
  • Configured the various things in settings.py (BROKER_HOST, BROKER_PORT, BROKER_USER, BROKER_PASSWORD, BROKER_VHOST, as well as importing djecelery, calling the setup function and adding it to the INSTALLED APPS). I've double checked and all of these values are correct (at least, user, password and vhost are correct).

So now, when I run python manage.py celeryd -l info I get connection errors (see below). Anyone have any idea why?

$ python manage.py celeryd -l info
/usr/local/lib/python2.7/dist-packages/djcelery/loaders.py:108: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!
  warnings.warn("Using settings.DEBUG leads to a memory leak, never "
[2012-05-15 18:38:04,486: WARNING/MainProcess]  

 -------------- celery@ubuntu v2.5.3
---- **** -----
--- * ***  * -- [Configuration]
-- * - **** ---   . broker:      amqp://celeryuser@localhost:5672/celeryhost
- ** ----------   . loader:      djcelery.loaders.DjangoLoader
- ** ----------   . logfile:     [stderr]@INFO
- ** ----------   . concurrency: 1
- ** ----------   . events:      OFF
- *** --- * ---   . beat:        OFF
-- ******* ----
--- ***** ----- [Queues]
 --------------   . celery:      exchange:celery (direct) binding:celery


[Tasks]


[2012-05-15 18:38:04,562: INFO/PoolWorker-1] child process calling self.run()
[2012-05-15 18:38:04,565: WARNING/MainProcess] celery@ubuntu has started.
[2012-05-15 18:38:07,572: ERROR/MainProcess] Consumer: Connection Error: [Errno 104] Connection reset by peer. Trying again in 2 seconds...
^C[2012-05-15 18:38:08,434: WARNING/MainProcess] celeryd: Hitting Ctrl+C again will terminate all running tasks!
[2012-05-15 18:38:08,435: WARNING/MainProcess] celeryd: Warm shutdown (MainProcess)
[2012-05-15 18:38:09,372: INFO/PoolWorker-1] process shutting down
[2012-05-15 18:38:09,373: INFO/PoolWorker-1] process exiting with exitcode 0
[2012-05-15 18:38:09,376: INFO/MainProcess] process shutting down

解决方案

Your problem is in the BROKER_URL.

With an additional VHOST, the right config would be:

BROKER_URL='amqp://celeryuser@localhost:5672//'
BROKER_VHOST='/celeryhost'

这篇关于消费者连接错误与django和芹菜+ rabbitmq?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆