如何在rabbitmq集群中重新安装死节点

时间:2018-01-03 23:26:38

标签: rabbitmq rabbitmqctl

我在rabbit1,rabbit2和rabbit3上有一个rabbitmq集群。 Rabbit2和Rabbit3将rabbit1集群作为RAM节点加入。兔子3坠毁了。在rabbit1和rabbit2中,当检查群集状态时,我得到了以下答案。

ubuntu@rabbit2:~$ sudo rabbitmqctl cluster_status
Cluster status of node rabbit@rabbit2
[{nodes,[{disc,[rabbit@rabbit1]},{ram,[rabbit@rabbit3,rabbit@rabbit2]}]},
 {running_nodes,[rabbit@rabbit1,rabbit@rabbit2]},
 {cluster_name,<<"rabbit@localhost">>},
 {partitions,[]},
 {alarms,[{rabbit@rabbit1,[]},{rabbit@rabbit2,[]}]}]

现在我卸载rabbitmq3并重新安装。在rabbit3上成功安装rabbitmq。

sudo service rabbitmq-server stop
sudo rm -rf /var/lib/rabbitmq/
sudo apt-get remove rabbitmq-server -y
sudo apt-get autoremove -y 
sudo apt-get install rabbitmq-server -y

安装完成后,我尝试再次将rabbit3添加到集群中。第一步,我检查rabbit3上的集群状态。

ubuntu@rabbit3:~$ sudo rabbitmqctl cluster_status
Cluster status of node rabbit@rabbit3
[{nodes,[{disc,[rabbit@rabbit3]}]},
 {running_nodes,[rabbit@rabbit3]},
 {cluster_name,<<"rabbit@localhost">>},
 {partitions,[]},
 {alarms,[{rabbit@rabbit3,[]}]}]

然后我覆盖了cookie文件

ubuntu@rabbit3:~$ sudo sh -c "echo abcdefg > /var/lib/rabbitmq/.erlang.cookie"
ubuntu@rabbit3:~$ sudo cat  /var/lib/rabbitmq/.erlang.cookie
abcdefg

再次检查群集。

ubuntu@rabbit3:~$ sudo rabbitmqctl cluster_status
Cluster status of node rabbit@rabbit3
Error: unable to connect to node rabbit@rabbit3: nodedown

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

attempted to contact: [rabbit@rabbit3]

rabbit@rabbit3:
  * connected to epmd (port 4369) on rabbit3
  * 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-25@localhost'
- home dir: /var/lib/rabbitmq
- cookie hash: esZsDxSN6VGbi9JkMSxNZA==

rabbit @ rabbit3节点无法连接,无法再配置它。我检查了rabbitmq安装文件。介绍了如何使用快乐路径配置集群。 但是如果节点已经死了,那么如何重新安装它。

1 个答案:

答案 0 :(得分:0)

我在安装过程中犯了一个错误,一般来说,我应该在设置cookie之前停止rabbitmq,比如

$Location = "C:\Code\Bulgaria_Test"

$items = Get-ChildItem -Path $Location -Filter DIL_BG_TXN*.dat

ForEach ($item in $items) {

    Write-Host "Processing file - " $item

    cmd /c copy /b BOMMarker.txt+$item ($item.BaseName + '.txt')

}