尝试将消息发送到远程队列时出现 pika.exceptions

时间:2023-04-27
本文介绍了尝试将消息发送到远程队列时出现 pika.exceptions.ProbableAuthenticationError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在尝试运行 RabbitMQ Python 教程,但使用了发件人在 virtualbox 主机和接收器上,并在 virtualbox 客户机上排队.所以我修改了提到的 send.py 代码,仅将 localhost 替换为 192.168.1.5.当我运行它时,我收到以下错误:

I'm trying to run RabbitMQ Python tutorial but with sender on virtualbox host machine and receiver and queue on virtualbox guest machine. So I modified mentioned send.py code by only replacing localhost with 192.168.1.5. When I run it, i receive following error:

...
  File "/home/damian/.virtualenvs/kivy_1.9/local/lib/python2.7/site-packages/pika/adapters/base_connection.py", line 153, in _check_state_on_disconnect
    raise exceptions.ProbableAuthenticationError
pika.exceptions.ProbableAuthenticationError

rabbitmq-server 似乎正在运行,因为当我停止它时 send.py 给了我:

rabbitmq-server seems to be running, because when I stop it send.py gives me:

...
  File "/home/damian/.virtualenvs/kivy_1.9/local/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 301, in _adapter_connect
    raise exceptions.AMQPConnectionError(error)
pika.exceptions.AMQPConnectionError: Connection to 192.168.1.5:5672 failed: [Errno 111] Connection refused

这很有意义.

如何解决这个ProbableAuthenticationError?

主机是 Debian 7,带有 Python 2.7.3 和 pika 0.9.14,来宾是 Ubuntu 15.04,带有 rabbitmq-server 3.4.3-2

Host machine is Debian 7 with Python 2.7.3 and pika 0.9.14, guest is Ubuntu 15.04 with rabbitmq-server 3.4.3-2

推荐答案

这是因为您尝试使用用户名和密码 guest 远程进行身份验证.从 RabbitMQ 3.3 开始,您需要创建一个新帐户才能使用远程,guest/guest只能在本地使用.

This is because you are trying to authenticate using the username and password guest remotely. Starting with RabbitMQ 3.3 you need to create a new account to use remotely, and guest/guest can only be used locally.

这取自更改日志这里.

25603 prevent access using the default guest/guest credentials except via localhost since (1.0.0)

可以通过从 loopback_users 中删除 guest 来修改 RabbitMQ 配置以允许使用 guest 帐户进行远程访问,但建议创建一个新用户以最好地遵循实践.

It's possible to modify the RabbitMQ configuration to allow remote access using the guest account, by removing guest from loopback_users, but it's recommended to create a new user to follow best practices.

[{rabbit, [{loopback_users, []}]}].

这篇关于尝试将消息发送到远程队列时出现 pika.exceptions.ProbableAuthenticationError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

上一篇:如何从 rabbitMQ 中永久删除 celery 任务? 下一篇:Pika blocking_connection.py 连接到 RabbitMQ 的随机超时

相关文章

最新文章