說明
本來是要先把Hystrix 儀表盤更完的,但是出現了Turbine、Dashboard、RabbitMQ整合實現監控。
所以先在學RabbitMq的基本操作,在安裝過程中出現了
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 failed
、suggestion: is the cookie set correctly?
這兩行,在網上看了兩個小時了,發現很多都是不明所以弄成了就隨便捊一下就寫。。
有一些現在沒有suggestion的輸出,這不是很重要,這里我先恢復事故現場,大家一起踩坑
WorkArounds
問題復現
分別安裝 Erlang (otp_win64_20.3.exe) 、RabbitMQ Server(rabbitmq-server-3.7.5.exe)
這里為了能看清晰問題是出在安裝目錄上還是其它,都裝到D盤,其他不變
安裝完成在菜單欄中會有這個顯示,這里用win10演示(公司電腦)
查看服務,服務已經正常啟動
cmd命令cd到D:\RabbitMQ Server\rabbitmq_server-3.7.5\sbin (你實際的安裝位置)
小提示:如果是默認的安裝位置,用
可以直接定位到sbin下
輸入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\systemprofile
和C:\Users\你的用戶名
下的cookie是同一個文件!
替換完成后,無需重啟服務,直接rabbitmqctl status
,如圖這樣就成功了。
以上