服務(wù)器異常宕機,導(dǎo)致RabbitMQ啟動失敗

問題原因: 由于服務(wù)器異常宕機導(dǎo)致RabbitMQ掛掉,服務(wù)器恢復(fù)之后嘗試啟動MQ發(fā)現(xiàn)啟動失敗挪略。報錯信息如下

[root@bogon rabbitMq]# rabbitmqctl  start_app
Error: unable to perform an operation on node 'rabbit@iZbp128yw4rvtfbytgv4y7Z'. 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@iZbp128yw4rvtfbytgv4y7Z
 * If target node is configured to use long node names, don't forget to use --longnames with CLI tools

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

attempted to contact: [rabbit@iZbp128yw4rvtfbytgv4y7Z]

rabbit@iZbp128yw4rvtfbytgv4y7Z:
  * connected to epmd (port 4369) on iZbp128yw4rvtfbytgv4y7Z
  * epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic 
  * can't establish TCP connection to the target node, reason: timeout (timed out)
  * suggestion: check if host 'iZbp128yw4rvtfbytgv4y7Z' resolves, is reachable and ports 25672, 4369 are not blocked by firewall

Current node details:
 * node name: 'rabbitmqcli-5146-rabbit@iZbp128yw4rvtfbytgv4y7Z'
 * effective user's home directory: /var/lib/rabbitmq
 * Erlang cookie hash: mVWZ9hzwnH+BCsNzXPPxQA==

查看狀態(tài):

rabbitmqctl status

報錯如下:

Error: unable to perform an operation on node ‘rabbit@iZbp128yw4rvtfbytgv4y7Z’. 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@iZbp128yw4rvtfbytgv4y7Z
If target node is configured to use long node names, don’t forget to use --longnames with CLI tools
DIAGNOSTICS
===========
attempted to contact: [‘rabbit@iZbp128yw4rvtfbytgv4y7Z’]

rabbit@iZbp128yw4rvtfbytgv4y7Z:

connected to epmd (port 4369) on iZbp128yw4rvtfbytgv4y7Z
epmd reports: node ‘rabbit’ not running at all
no other nodes on iZbp128yw4rvtfbytgv4y7Z
suggestion: start the node
Current node details:

node name: ‘rabbitmqcli-11079-rabbit@iZbp128yw4rvtfbytgv4y7Z’
effective user’s home directory: /root
Erlang cookie hash: vVAgrz18VW8gDZQB2YRW8A==

解決:

  • 有可能是因為我們停止的時候進程并未完全關(guān)閉或者是被其他應(yīng)用占用,導(dǎo)致后續(xù)重啟失敗,rabbitmq沒有啟動.
    Rabbitmq-server默認占用的端口號有:5672、15672箕般、25672瘤泪、4369
    查詢lsof -i :4369端口占用進程pidkill -9 pid殺死相關(guān)進程之后重啟發(fā)現(xiàn)報錯依舊,且4369端口kill時顯示進程不存在但是重新查詢端口占用發(fā)現(xiàn)另一個進程占用該端口
  • Error: unable to perform an operation on node ‘rabbit@iZbp128yw4rvtfbytgv4y7Z’.根據(jù)這段錯誤信息查詢到有可能是ip映射問題,故在 /etc/hosts 文件做一個映射,就將hostname iZbp128yw4rvtfbytgv4y7Z與本機ip映射了一下货矮。保存,source /etc/hosts 斯够。啟動MQ報錯依舊
ifconfig #查詢到本機內(nèi)網(wǎng)IP為: 10.25.0.181
#方式一: 
echo 10.25.0.181 iZbp128yw4rvtfbytgv4y7Z >> /etc/host #直接將映射內(nèi)容寫入host文件
#方式二:
vim /etc/hosts #按 i 進入編輯模式
# 添加一條ip映射到本機
10.25.0.181 iZbp128yw4rvtfbytgv4y7Z
# Esc 退出編輯模式
:wq #保存文件并退出
source /etc/hosts #刷新映射文件 報錯-bash: 127.0.0.1: 未找到命令 -bash: ::1: 未找到命令 -bash: 10.25.0.181: 未找到命令
  • 本人最終解決方式
journalctl -xe #查看系統(tǒng)日志排查MQ啟動失敗原因

系統(tǒng)日志如下:

-- Subject: Unit rabbitmq-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rabbitmq-server.service has failed.
-- 
-- The result is failed.
8月 19 11:15:38 iZbp128yw4rvtfbytgv4y7Z systemd[1]: Unit rabbitmq-server.service entered failed state.
8月 19 11:15:38 iZbp128yw4rvtfbytgv4y7Z systemd[1]: rabbitmq-server.service failed.
8月 19 11:15:48 iZbp128yw4rvtfbytgv4y7Z systemd[1]: rabbitmq-server.service holdoff time over, scheduling restart.
8月 19 11:15:48 iZbp128yw4rvtfbytgv4y7Z systemd[1]: Stopped RabbitMQ broker.
-- Subject: Unit rabbitmq-server.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rabbitmq-server.service has finished shutting down.
8月 19 11:15:48 iZbp128yw4rvtfbytgv4y7Z systemd[1]: Starting RabbitMQ broker...
-- Subject: Unit rabbitmq-server.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rabbitmq-server.service has begun starting up.
8月 19 11:15:49 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: Configuring logger redirection
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: ##  ##      RabbitMQ 3.8.19
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: ##  ##
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: ##########  Copyright (c) 2007-2021 VMware, Inc. or its affiliates.
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: ######  ##
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: ##########  Licensed under the MPL 2.0. Website: https://rabbitmq.com
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: Erlang:      23.3.4.4 [emu]
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: TLS Library: OpenSSL - OpenSSL 1.0.2k-fips  26 Jan 2017
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: Doc guides:  https://rabbitmq.com/documentation.html
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: Support:     https://rabbitmq.com/contact.html
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: Tutorials:   https://rabbitmq.com/getstarted.html
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: Monitoring:  https://rabbitmq.com/monitoring.html
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: Logs: /var/log/rabbitmq/rabbit@iZbp128yw4rvtfbytgv4y7Z.log
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: /var/log/rabbitmq/rabbit@iZbp128yw4rvtfbytgv4y7Z_upgrade.log
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: Config file(s): (none)
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: Starting broker...
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: BOOT FAILED
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: ===========
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: Error during startup: {error,
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: {cannot_delete_plugins_expand_dir,
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: ["/var/lib/rabbitmq/mnesia/rabbit@iZbp128yw4rvtfbytgv4y7Z-plugins-expand",
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: {cannot_delete,
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: "/var/lib/rabbitmq/mnesia/rabbit@iZbp128yw4rvtfbytgv4y7Z-plugins-expand/cowboy-2.8.0/ebin/cowboy_app.beam",
8月 19 11:15:53 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: eacces}]}}
8月 19 11:15:55 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: {"Kernel pid terminated",application_controller,"{application_start_failure,rabbit,{{cannot_delete_plugins_expand_dir,[\"/var/lib/rabbitmq/mnesia/rabbit@iZbp128yw4rvtfb
8月 19 11:15:55 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: Kernel pid terminated (application_controller) ({application_start_failure,rabbit,{{cannot_delete_plugins_expand_dir,["/var/lib/rabbitmq/mnesia/rabbit@iZbp128yw4rvtfbyt
8月 19 11:15:55 iZbp128yw4rvtfbytgv4y7Z rabbitmq-server[16624]: Crash dump is being written to: /var/log/rabbitmq/erl_crash.dump...done
8月 19 11:15:55 iZbp128yw4rvtfbytgv4y7Z systemd[1]: rabbitmq-server.service: main process exited, code=exited, status=1/FAILURE
8月 19 11:15:55 iZbp128yw4rvtfbytgv4y7Z systemd[1]: Failed to start RabbitMQ broker.

刪除/var/lib/rabbitmq/mnesia 目錄下的rabbit@iZbp128yw4rvtfbytgv4y7Z.pid囚玫、rabbit@iZbp128yw4rvtfbytgv4y7Z、rabbit@iZbp128yw4rvtfbytgv4y7Z-plugins-expand后读规,再使用systemctl start rabbitmq-server啟動抓督,成功啟動MQ。
注意 :文件中包含交換機隊列及用戶等信息,刪除等于重置MQ(隊列會被清空),請謹慎操作

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末束亏,一起剝皮案震驚了整個濱河市铃在,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌碍遍,老刑警劉巖定铜,帶你破解...
    沈念sama閱讀 211,194評論 6 490
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異雀久,居然都是意外死亡宿稀,警方通過查閱死者的電腦和手機趁舀,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,058評論 2 385
  • 文/潘曉璐 我一進店門赖捌,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事越庇≌秩瘢” “怎么了?”我有些...
    開封第一講書人閱讀 156,780評論 0 346
  • 文/不壞的土叔 我叫張陵卤唉,是天一觀的道長涩惑。 經(jīng)常有香客問我,道長桑驱,這世上最難降的妖魔是什么竭恬? 我笑而不...
    開封第一講書人閱讀 56,388評論 1 283
  • 正文 為了忘掉前任,我火速辦了婚禮熬的,結(jié)果婚禮上痊硕,老公的妹妹穿的比我還像新娘。我一直安慰自己押框,他們只是感情好岔绸,可當(dāng)我...
    茶點故事閱讀 65,430評論 5 384
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著橡伞,像睡著了一般盒揉。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上兑徘,一...
    開封第一講書人閱讀 49,764評論 1 290
  • 那天刚盈,我揣著相機與錄音,去河邊找鬼挂脑。 笑死扁掸,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的最域。 我是一名探鬼主播谴分,決...
    沈念sama閱讀 38,907評論 3 406
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼镀脂!你這毒婦竟也來了牺蹄?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 37,679評論 0 266
  • 序言:老撾萬榮一對情侶失蹤薄翅,失蹤者是張志新(化名)和其女友劉穎沙兰,沒想到半個月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體翘魄,經(jīng)...
    沈念sama閱讀 44,122評論 1 303
  • 正文 獨居荒郊野嶺守林人離奇死亡鼎天,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,459評論 2 325
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了暑竟。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片斋射。...
    茶點故事閱讀 38,605評論 1 340
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出罗岖,到底是詐尸還是另有隱情涧至,我是刑警寧澤,帶...
    沈念sama閱讀 34,270評論 4 329
  • 正文 年R本政府宣布桑包,位于F島的核電站南蓬,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏哑了。R本人自食惡果不足惜赘方,卻給世界環(huán)境...
    茶點故事閱讀 39,867評論 3 312
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望弱左。 院中可真熱鬧蒜焊,春花似錦、人聲如沸科贬。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,734評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽榜掌。三九已至优妙,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間憎账,已是汗流浹背套硼。 一陣腳步聲響...
    開封第一講書人閱讀 31,961評論 1 265
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留胞皱,地道東北人邪意。 一個月前我還...
    沈念sama閱讀 46,297評論 2 360
  • 正文 我出身青樓,卻偏偏與公主長得像反砌,于是被迫代替她去往敵國和親雾鬼。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 43,472評論 2 348

推薦閱讀更多精彩內(nèi)容