前言

  • erlang 23.1
  • rabbitmq server v3.8.9
  • win 10

问题描述

使用 rabbitmqctl 命令时出现错误:

C:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.9\sbin> rabbitmqctl status
Error: unable to perform an operation on node 'rabbit@DESKTOP-1GHM2HM'. 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@DESKTOP-1GHM2HM
 * If target node is configured to use long node names, don't forget to use --longnames with CLI tools

DIAGNOSTICS
===========

attempted to contact: ['rabbit@DESKTOP-1GHM2HM']

rabbit@DESKTOP-1GHM2HM:
  * connected to epmd (port 4369) on DESKTOP-1GHM2HM
  * epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic
  * TCP connection succeeded but Erlang distribution failed

  * Authentication failed (rejected by the remote node), please check the Erlang cookie


Current node details:
 * node name: 'rabbitmqcli-20064-rabbit@DESKTOP-1GHM2HM'
 * effective user's home directory: C:\Users\admin
 * Erlang cookie hash: 37DhljkMemAT0RSfiJUaUQ==

有用的错误信息:Authentication failed (rejected by the remote node), please check the Erlang cookie

错误分析

官方说明 如下
在这里插入图片描述
核心思想是:RabbitMQ Windows service启动时使用的 erlang cookie,与 RabbitMQ 命令行执行时使用的 erlang cookie,位置不一致。

解决办法

官方解决办法是:复制RabbitMQ Windows service启动时使用的 erlang cookie,覆盖掉RabbitMQ 命令行执行时使用的 erlang cookie。

非官方解决办法有:

  • 按照低版本的 erlang。(PS: 这个没试过)
  • 使用命令行启动 RabbitMQ 。(执行 rabbitmq-server.bat 命令启动 RabbitMQ)

参考

https://www.rabbitmq.com/cli.html#erlang-cookie
https://blog.csdn.net/J_Shine/article/details/78833456
https://www.cnblogs.com/hellxz/p/9104028.html
https://blog.csdn.net/yangl1337905751/article/details/80318055
https://www.rabbitmq.com/install-windows-manual.html

Logo

鸿蒙生态一站式服务平台。

更多推荐