7

我有我的芹菜配置

BROKER_URL = 'redis://127.0.0.1:6379'
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379'

然而,每当我运行 celeryd 时,我都会收到此错误

consumer: Cannot connect to amqp://guest@127.0.0.1:5672//: [Errno 111] Connection refused. Trying again in 2.00 seconds...

为什么它没有连接到我设置的 redis 代理,它正在运行 btw?

4

3 回答 3

6

导入您的芹菜并像这样添加您的经纪人:

celery = Celery('task', broker='redis://127.0.0.1:6379')
celery.config_from_object(celeryconfig)

此代码属于 celery.py

于 2013-08-08T09:56:38.200 回答
4

如果您遵循Celery教程的第一步,特别是:

app.config_from_object('django.conf:settings', namespace='CELERY')

那么你需要在你的设置前面加上前缀CELERY,所以将你的更改BROKER_URL为:

CELERY_BROKER_URL = 'redis://127.0.0.1:6379'
于 2017-05-29T23:03:04.087 回答
0

我收到此回复是因为我在终端上错误地启动了我的芹菜工人。

我之前在跑步:

celery -A celery worker

但是因为我celery在里面定义了web/server.py,我需要运行:

celery -A web.server.celery worker

web.server表示我的celery对象位于目录 web 内的文件 server.py 中。运行连接到我指定的代理的后一个命令!

于 2019-06-19T22:26:06.117 回答