在linux 上安装 RabbitMQ 后, 新增账号,执行:
sudo ./sbin/rabbitmqctl add_user user_name password
报错如下所示:
Error: unable to perform an operation on node 'rabbit@localhost'. Please see diagnostics information and suggestions below.
Most common reasons for this are:
* Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
* CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
* Target node is not running
In addition to the diagnostics info below:
* See the CLI, clustering and networking guides on https://rabbitmq.com/documentation.html to learn more
* Consult server logs on node rabbit@localhost
* If target node is configured to use long node names, don't forget to use --longnames with CLI tools
错误的原因是 Erlang 的 cookie 出现问题,Erlang 会生成两个 cookie 文件:
1、当前用户的cookie
~/.erlang.cookie
2、root下的cookie
/root/.erlang.cookie
将1中的替换2中的内容。
然后重启 RabbitMQ即可。
https://www.freesion.com/article/12181350043/
https://my.oschina.net/hncscwc/blog/262246