各位!
我想使用管理员级别的登录名和密码连接到带有aio_pika的rabbitmq。
async def send_rmq(message) -> None:
connection = await connect("amqp://login:password@url")
字符串
连接时出错:
aiormq.exceptions.ProbableAuthenticationError: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
型
我尝试通过web界面和curl命令进行连接:
curl -s -u login:password http://url:15672/api/queues/%2F/name_queue | grep -o '"messages":[0-9]*'
型
我登录到界面,得到curl命令的实际数值,也就是网络没有问题,正如我所理解的。
会有什么问题呢?
我在一个远程服务器上工作,项目在Docker中运行,Rabbit在另一个服务器上运行,也在Docker中。我从我工作的远程服务器的终端发送的 curl 请求
1条答案
按热度按时间0s0u357o1#
可以使用ip地址,并确保用户是RabbitMQ中的管理员:
https://www.rabbitmq.com/uri-spec.html,带有IP的URI示例:
字符串
并检查您是否可以使用例如tcn或其他命令访问远程服务器。
在代码异常后也检查RabbitMQ的日志:
型
RabbitMQ Management->Overview->Nodes->Nodename = config and log files location.
经纪人文件(原因如下):
型
将密码更新为新密码,这可能是问题所在。
示例https://aio-pika.readthedocs.io/en/latest/quick-start.html
工作结果https://github.com/spawnmarvel/test/blob/main/aio5.jpg