模拟RabbitMQ网络分区

1. 概述

正常情况下,很难观察到RabbitMQ网络分区的发生。为了更好的理解网络分区,需要某些手段将其模拟出来,以便对其做相应的分析处理,进而在正式应用环境中遇到类似情形可以处理的游刃有余。往长远方面讲,也可以采取一些必要的手段去避免网络分区的发生,或者可以监控网络分区以便对其迅速处理。


RabbitMQ Network Partitions 处理策略

网络分区的意义

RabbitMQ的模型类似交换机模型,且采用erlang这种电信网络方面的专用语言实现。RabbitMQ集群是不能跨LAN部署(如果要WAN部署需要采用专门的插件)的,也就是基于网络情况良好的前提下运行的。这种假设就好比paxos并不解决拜占庭问题。


RabbitMQ Network Partitions 服务日志对比

如果你一直使用RabbitMQ作为业务的消息中间件,难免会遇到网络分区(Network Partitions)的故障,也许你当时会束手无策,一脸懵逼,不过希望在看完这篇文章之后,能给你一点解决网络分区的思路。


【译】RabbitMQ Network Partitions

Clustering and Network Partitions

RabbitMQ clusters do not tolerate network partitions well. If you are thinking of clustering across a WAN, don’t. You should use federation or the shovel instead.
However, sometimes accidents happen. This page documents how to detect network partitions, some of the bad effects that may happen during partitions, and how to recover from them.
RabbitMQ stores information about queues, exchanges, bindings etc in Erlang’s distributed database, Mnesia. Many of the details of what happens around network partitions are related to Mnesia’s behaviour.


RabbitMQ脑裂

在RabbitMQ3.4.x中会出现错误的网络分区检测(某种意义上可以称之为脑裂)的现象,本文通过实验验证此现象,愿小伙伴们少走弯路。

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×