django 和 celery+rabbitmq 的消费者连接错误?

Consumer Connection error with django and celery+rabbitmq?(django 和 celery+rabbitmq 的消费者连接错误?)
本文介绍了django 和 celery+rabbitmq 的消费者连接错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

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

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

  • 从 pip 安装 celery
  • 通过存储库中可用的 deb 安装 rabbitmq
  • 通过 rabbitmqctl 向 rabbitmq 添加了一个用户和虚拟主机,以及该用户的权限
  • 启动rabbitmq-server
  • 通过 pip 安装 django-celery
  • 设置 django-celery,包括它的表
  • 在settings.py中配置好各种东西(BROKER_HOST, BROKER_PORT, BROKER_USER, BROKER_PASSWORD, BROKER_VHOST,以及导入djecelery,调用setup函数,添加到INSTALLED APPS).我仔细检查了所有这些值都是正确的(至少,用户、密码和虚拟主机是正确的).

所以现在,当我运行 python manage.py celeryd -l info 时出现连接错误(见下文).有人知道为什么吗?

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

推荐答案

你的问题出在BROKER_URL.

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

With an additional VHOST, the right config would be:

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

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

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Seasonal Decomposition of Time Series by Loess with Python(Loess 用 Python 对时间序列进行季节性分解)
Resample a time series with the index of another time series(使用另一个时间序列的索引重新采样一个时间序列)
How can I simply calculate the rolling/moving variance of a time series in python?(如何在 python 中简单地计算时间序列的滚动/移动方差?)
How to use Dynamic Time warping with kNN in python(如何在python中使用动态时间扭曲和kNN)
Keras LSTM: a time-series multi-step multi-features forecasting - poor results(Keras LSTM:时间序列多步多特征预测 - 结果不佳)
Python pandas time series interpolation and regularization(Python pandas 时间序列插值和正则化)