前言
系统版本:CentOS Linux release 7.7.1908 (Core)
通过rabbitmqctl add_user admin 12345指令,给rabbitmq添加用户提示出错:
[root@localhost perl]# rabbitmqctl add_user admin 12345
Error: unable to connect to node rabbit@localhost: nodedown
DIAGNOSTICS
===========
attempted to contact: [rabbit@localhost]
rabbit@localhost:
* connected to epmd (port 4369) on localhost
* epmd reports node \’rabbit\’ running on port 25672
* TCP connection succeeded but Erlang distribution failed
* Authentication failed (rejected by the remote node), please check the Erlang cookie
current node details:
– node name: \’rabbitmq-cli-49@localhost\’
– home dir: /root
– cookie hash: BgvEr+lGkDjLTQzT85cpyw==
解决方案
1)搜索.erlang.cookie文件
[root@localhost mnesia]# find / -name *.cookie
/root/.erlang.cookie
/opt/rabbitmq_server-3.6.10/.erlang.cookie
2)覆盖掉/root/.erlang.cookie文件
cp /opt/rabbitmq_server-3.6.10/.erlang.cookie /root/
原因
RabbitMQ的.erlang.cookie和用户的cookie冲突了,需要用RabbitMQ的cookie去覆盖用户的cookie