问题

在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

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐