Rabbitmq: Erlang distribution failed solution

Preface
System version: CentOS Linux release 7.7.1908 (Core)
Adding a user to rabbitmq via the rabbitmqctl add_user admin 12345 command prompts an error.
[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==

 

Solution:
1)Search the .erlang.cookie file
[root@localhost mnesia]# find/-name *.cookie
/root/.erlang.cookie
/opt/rabbitmq_server-3.6.10/.erlang.cookie
2)Overwrite the /root/.erlang.cookie file
cp /opt/rabbitmq_server-3.6.10/.erlang.cookie  /root/

Cause:
RabbitMQ’s .erlang.cookie conflicts with the user’s cookie and needs to override the user’s cookie with RabbitMQ’s cookie

Read More: