当前位置: 首页 > 工具软件 > cli-guides > 使用案例 >

Linux RabbitMQ - CLI tool fails to authenticate with the server

白越
2023-12-01

问题

在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

 类似资料:

相关阅读

相关文章

相关问答