我一直收到此错误,我不知道为什么。我在Windows 10上使用Ubuntu,芹菜曾经工作正常。然后发生了一些事情,我一直收到此错误。我使用芹菜文档来学习。
以下是 task.py:
from celery import Celery
app = Celery('tasks', broker='pyamqp://guest@localhost//')
@app.task
def add(x, y):
return x + y
这是我得到的错误:
[2017-08-14 17:34:04,436: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 92] Protocol not available.
Trying again in 2.00 seconds...
[2017-08-14 17:34:06,453: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 92] Protocol not available.
Trying again in 4.00 seconds...
[2017-08-14 17:34:10,465: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 92] Protocol not available.
Trying again in 6.00 seconds...
[2017-08-14 17:34:16,480: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 92] Protocol not available.
Trying again in 8.00 seconds...
为了启动芹菜,我键入:
celery -A tasks worker --loglevel=info
你最近更新了 amqp 吗?
似乎从 Linux 子系统连接到 RabbitMQ 实例不再可能,因为 2.1.2 du 以上的版本到套接字巫术。
https://github.com/celery/py-amqp/issues/145
我建议尝试 Celery 可能支持的其他后端,我将尝试 redis 。至少降级到RabbitMQ 2.1.2也可以解决这个问题。