RabbitMQ异常:ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN.

生命无罪,健康万岁,我是laity。

Seven times have I despised my soul:

For the first time, it feigned humility when it could have been aggressive;

The second time, when it was empty, fill it with lust;

The third time, between difficult and easy, it chose easy;

For the fourth time, it made a mistake, but comforted itself by saying that others would also make mistakes;

The fifth time, it is free and weak, but it is regarded as the tenacity of life;

The sixth time, when it despises an ugly face, it does not know that it is one of its own masks;

For the seventh time, it leaned sideways in the mud of life, although it was not reconciled, it was timid.

Analyze error messages

An error occurred when starting rabbitmq:

ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.

  • Check whether the account password is correct
  • Check if your account password permission is granted
  • Is port 5672 normally open to the outside world?

Solution

  • First of all, let me explain that there is no problem with my rabbitmq environment setup, and it has passed
  • I created the admin through the command line (granted admin privileges), but did not specify the virtual hosts that can be accessed (Can access virtual hosts)
  • Virtual Host

A virtual host, representing a collection of exchanges, message queues, and related objects. Virtual hosts are separate domains of servers that share the same authentication and encryption environment. Each vhost is essentially a mini version of RabbitMQ server, with its own queue, switch, binding and permission mechanism.
vhost 是 AMQP 概念的基础,必须在连接时 指定,RabbitMQ 默认的 vhost 是 / 。

# 进入容器
docker exec -it rabbitmq /bin/bash
# 安装web端插件 - 当你进入不了管理页面时可能是没有开启这个插件
rabbitmq-plugins enable rabbitmq_management
# 新增用户 账号 admin 密码 admin
rabbitmqctl add_user admin admin
# 设置用户操作权限
rabbitmqctl set_user_tags admin administrator
#  退出
Exit
重新启动 mq
docker restart tabbitmq

insert image description here

  • So idea generates an exception and cannot connect to rabbitmq

An unexpected connection driver error occured

insert image description here

  • We need to set access permissions for the account
    1.insert image description here

2、insert image description here
insert image description here

  • With access to the virtual machine, the program can successfully access

Personal experience is for reference only~

Guess you like

Origin blog.csdn.net/duyun0/article/details/127564315