VCZYH

vuePress-theme-reco vczyh    2018 - 2020
VCZYH VCZYH

Choose mode

  • dark
  • auto
  • light
首页
分类
  • 后端
  • 随笔
  • 前端
  • 编程
标签云
时间轴
笔记
留言板
友链
About
author-avatar

vczyh

16

文章

17

标签

首页
分类
  • 后端
  • 随笔
  • 前端
  • 编程
标签云
时间轴
笔记
留言板
友链
About

RabbitMQ 网络分区

vuePress-theme-reco vczyh    2018 - 2020

RabbitMQ 网络分区

vczyh 2020-11-09 RabbitMQ
Hostname IP
node1 10.0.44.91
node2 10.0.44.92
node3 10.0.44.93

# 模拟网络分区

# 1. 让 node2 脱离集群

在 node2执行命令,关闭网卡。

ifdown ens3

# 2. 查看各节点状态

等待一分钟左右,在 node1查看集群状态,执行rabbitmqctl cluster_status,此时node1认为node2已经脱离集群。node3情况一样。

[root@node1 ~]# rabbitmqctl cluster_status
Cluster status of node rabbit@node1 ...
Basics

Cluster name: rabbit@node1

Disk Nodes

rabbit@node1
rabbit@node2
rabbit@node3

Running Nodes

rabbit@node1
rabbit@node3

Maintenance status

Node: rabbit@node1, status: not under maintenance
Node: rabbit@node3, status: not under maintenance

Network Partitions

(none)

在node2上执行rabbitmqctl cluster_status,显示信息,此时还没有出现网络分区。

# 3. 让 node2 恢复

node2恢复网卡。

ifup ens3

# 4. 查看各节点状态

查看 node1集群状态,检测到网络分区。node3情况一样。

[root@node1 ~]# rabbitmqctl cluster_status
Cluster status of node rabbit@node1 ...
Basics

Cluster name: rabbit@node1

Disk Nodes

rabbit@node1
rabbit@node2
rabbit@node3

Running Nodes

rabbit@node1
rabbit@node3

Maintenance status

Node: rabbit@node1, status: not under maintenance
Node: rabbit@node3, status: not under maintenance

Network Partitions

Node rabbit@node1 cannot communicate with rabbit@node2
Node rabbit@node3 cannot communicate with rabbit@node2

json格式。

"partitions":{
    "rabbit@node1":[
        "rabbit@node2"
    ],
    "rabbit@node3":[
        "rabbit@node2"
    ]
},

node1 web界面。

查看node2集群状态。

[root@node2 ~]# rabbitmqctl cluster_status
Cluster status of node rabbit@node2 ...
Basics

Cluster name: rabbit@node1

Disk Nodes

rabbit@node1
rabbit@node2
rabbit@node3

Running Nodes

rabbit@node2

Versions

rabbit@node2: RabbitMQ 3.8.9 on Erlang 22.3.4.11

Maintenance status

Node: rabbit@node2, status: not under maintenance

Network Partitions

Node rabbit@node2 cannot communicate with rabbit@node1, rabbit@node3

json格式。

"partitions":{
    "rabbit@node2":[
        "rabbit@node1",
        "rabbit@node3"
    ]
},

node2web 界面。

# 网络分区恢复

// TODO