Linux RabbitMQ - CLI tool fails to authenticate with the server

在Linux系统中安装RabbitMQ后尝试添加用户时遇到报错,问题根源在于Erlang的cookie不匹配。解决方案是同步当前用户和root用户的.cookie文件内容,并重启RabbitMQ服务。确保正确操作Erlang的cookie文件对于RabbitMQ管理操作至关重要。
摘要由CSDN通过智能技术生成

问题

在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

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值