RabbitMQ問題解決:TCP connection succeeded but Erlang distribution failed

說明

原本是要先把Hystrix 儀表盤更完的,可是出現了Turbine、Dashboard、RabbitMQ整合實現監控。html

因此先在學RabbitMq的基本操做,在安裝過程當中出現了node

E:\RabbitMQ Server\rabbitmq_server-3.6.5\sbin>rabbitmqctl status
Status of node 'rabbit@DESKTOP-T5RBR6M' ...
Error: unable to connect to node 'rabbit@DESKTOP-T5RBR6M': nodedown

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

attempted to contact: ['rabbit@DESKTOP-T5RBR6M']

rabbit@DESKTOP-T5RBR6M:
  * connected to epmd (port 4369) on DESKTOP-T5RBR6M
  * epmd reports node 'rabbit' running on port 25672
  * TCP connection succeeded but Erlang distribution failed
  * suggestion: hostname mismatch?
  * suggestion: is the cookie set correctly?
  * suggestion: is the Erlang distribution using TLS?

current node details:
- node name: 'rabbitmq-cli-27@DESKTOP-T5RBR6M'
- home dir: C:\Users\Administrator
- cookie hash: +Xg8GwzCRQiqRrJZqqF30A==

重點在TCP connection succeeded but Erlang distribution failedsuggestion: is the cookie set correctly?這兩行,在網上看了兩個小時了,發現不少都是不明因此弄成了就隨便捊一下就寫。。windows

有一些如今沒有suggestion的輸出,這不是很重要,這裏我先恢復事故現場,你們一塊兒踩坑bash

WorkArounds

問題復現

分別安裝 Erlang (otp_win64_20.3.exe) 、RabbitMQ Server(rabbitmq-server-3.7.5.exe)cookie

這裏爲了能看清晰問題是出在安裝目錄上仍是其它,都裝到D盤,其餘不變ide

安裝完成在菜單欄中會有這個顯示,這裏用win10演示(公司電腦)ui

查看服務,服務已經正常啓動this

cmd命令cd到D:\RabbitMQ Server\rabbitmq_server-3.7.5\sbin (你實際的安裝位置)code

小提示:若是是默認的安裝位置,用 能夠直接定位到sbin下orm

輸入rabbitmqctl status

D:\RabbitMQ Server\rabbitmq_server-3.7.5\sbin>rabbitmqctl status
Status of node rabbit@DESKTOP-T5RBR6M ...
Error: unable to perform an operation on node 'rabbit@DESKTOP-T5RBR6M'. 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 http://rabbitmq.com/documentation.html to learn more
 * Consult server logs on node rabbit@DESKTOP-T5RBR6M

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

attempted to contact: ['rabbit@DESKTOP-T5RBR6M']

rabbit@DESKTOP-T5RBR6M:
  * connected to epmd (port 4369) on DESKTOP-T5RBR6M
  * 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: 'rabbitmqcli49@DESKTOP-T5RBR6M'
 * effective user's home directory: C:\Users\Administrator
 * Erlang cookie hash: joVCp1tjZbhK/nWhgoYyjQ==

問題復現。

Authentication failed (rejected by the remote node), please check the Erlang cookie是重點,說明cookie可能有問題。

問題解決

這裏直接告訴你們問題出在哪吧,是Erlang新版本的cookie位置換了!

兩種解決辦法:

  • 使用舊版本Erlang
  • cookie替換到正確的位置

打開路徑C:\Windows\System32\config\systemprofile

咱們看到了這裏有一個.erlang.cookie,複製這個文件到C:\Users\你的用戶名

若是沒有這個文件,請打開菜單欄的Erlang快捷方式,出現白色窗口的時候,C:\Windows\System32\config\systemprofile這個目錄下就會出現這個文件,可能會慢一些耐心等

要確保C:\Windows\System32\config\systemprofileC:\Users\你的用戶名下的cookie是同一個文件!

替換完成後,無需重啓服務,直接rabbitmqctl status,如圖這樣就成功了。

以上

相關文章
相關標籤/搜索