问题

在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

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐