【问题标题】:Celery: consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 92] Protocol not available芹菜:消费者:无法连接到 amqp://guest:**@127.0.0.1:5672//:[Errno 92] 协议不可用
【发布时间】:2018-01-22 10:41:14
【问题描述】:

我不断收到此错误,我不知道为什么。我在 Windows 10 上使用 Ubuntu,而 celery 过去可以正常工作。然后发生了一些事情,我不断收到这个错误。我使用 celery docs 来学习。

这里是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,我输入:

celery -A tasks worker --loglevel=info

【问题讨论】:

    标签: python windows ubuntu celery


    【解决方案1】:

    您最近更新 amqp 了吗?

    似乎不再可能从 Linux 子系统连接到 RabbitMQ 实例,因为 2.1.2 之后的版本都使用套接字巫术。

    https://github.com/celery/py-amqp/issues/145

    我建议尝试 Celery 可能支持的其他后端,我将尝试 redis。至少降级到 RabbitMQ 2.1.2 也可以解决问题。

    【讨论】:

    • 更新:我终于切换到了 redis,因为 RMQ 2.1.2 已经很老了。现在一切正常。
    • 感谢您的回答。我试图在最后一个小时内找到解决方案。你的回答终于救了我。赞一个。
    猜你喜欢
    • 2020-03-12
    • 2018-10-17
    • 2019-01-10
    • 2018-10-24
    • 2023-01-10
    • 2020-06-07
    • 2023-03-14
    • 1970-01-01
    • 2020-12-30
    相关资源
    最近更新 更多