[RabbitMQ]Windows環境下rabbitmqclt(Command Line Tools)出現Erlang distribution failed錯誤的解決方法


摘要

當使用rabbitmqctl時出現Erlang distribution failed,把%SystemRoot%Windows\System32\config\systemprofile下的.erlang.cookie 復制到%SystemRoot%\Users\UsersName后重啟RabbitMQ服務

前情概要

今天在使用RabbitMQ突然無法登陸Web Management,用rabbitmqctl的list_user命令查看用戶時發現報了如下錯誤

attempted to contact: ['rabbit@nodeB']
rabbit@nodeB:
* connected to epmd (port 4369) on nodeB
* epmd reports node 'rabbit' running on port 25672
* TCP connection succeeded but Erlang distribution failed
* Authentication failed (rejected by the remote node), please check the Erlang cookie
current node details:
- node name: rabbitmqcli70@NULL
- effective user's home directory: C:\Users\**
- Erlang cookie hash: *********==

重點在這兩行

TCP connection succeeded but Erlang distribution failed
please check the Erlang cookie

因此,重點從erlang cookie下手

解決過程

百度和stackoverflow,無果,基本都是用管理員身份重裝RabbitMQ,然而實際問題並不在此。於是直奔官網。

在RabbitMQ官網Command Line Tools下發現erlang Cookie除了Users文件夾下還有另一個存放的地方,對比發現systemprofile里的才是正確的cookie,替換Users下的cookie后重啟RabbitMQ ,運行rabbitmqctl,可以正常運行命令了

正常運行list_user發現guest用戶被刪除了,重新利用rabbitmqctl建立一個管理員用戶之后終於可以登錄Management了。以防萬一,也為了調試方便,在Admin頁面重新建立guest用戶。

實際上,RabbitMQ nodes與CLT tools利用erlang cookie來辨認它們之間是否能互相連接,若兩個erlang cookie不一致則無法使用CLI tools

下面貼出解決方法,有興趣的可以去最下方的鏈接,在RabbitMQ官網查看具體說明

解決方法

  1. %SystemRoot%Windows\System32\config\systemprofile\中復制.erlang.cookie
  2. <%SystemRoot%\Users\UsersName>中把上一步的.erlang.cookie覆蓋此文件夾的.erlang.cookie(以防萬一先復制副本)
  3. 重啟RabbitMQ服務,這一步應該可以忽略
  4. 重新打開rabbitmqctl,現在可以執行命令了

相關鏈接:

http://www.rabbitmq.com/cli.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM