说MGR - MGR的基本原理
admin
2023-01-26 00:40:50
0

状态机复制


MGR本质上一个状态机复制的集群。在状态机复制的架构中,数据库被当做一个状态机。每一次写操作都会导致数据库的状态变化。为了创建一个高可用的数据库集群,有一个组件,即事务分发器,将这些操作按照同样的顺序发送到多个初始状态一致的数据库上,让这些数据库执行同样的操作。因为初始状态相同,每次执行的操作也相同,所以每次状态变化后各个数据库上的数据保持一致。



分布式的状态机复制


事务分发器是一个单点,为了避免单点故障,可以采用分布式的状态机复制。在分布式的状态机复制中,有多个事务分发器,它们彼此互相通信。事务分发器可以同时接收事务请求,就像单个事务分发器同时接收事务请求一样。从应用层来说,并发的事务发到同一个事务分发器和发到不同的事务分发器上效果是一样的。事务分发器之间会互相通信,把所有的事务汇总、排序。最终,每个事务分发器上都有一份完整的排好序的事务请求。每个事务分发器只连接到一个数据库上,并负责把事务请求依次发送到相连的数据库上去执行,其就是一个分布式状态机复制的模型了。



分布式的高可用数据库


将分布式的事务分发模块集成到数据库系统中,就变成了一个分布式的高可用数据库系统。用户通过数据库的用户接口执行事务。数据库收到事务请求后,首先交由事务分发模块处理。事务分发模块将事务汇总排序,然后依次交由数据处理模块去执行这些事务。如果去掉内部的细节,就会发现这是一个非常简洁的数据库集群方案。MGR就是这样一个分布式的高可用MySQL系统。



品味来自官档的一段话~


The most common way to create a fault-tolerant system is to resort to making components redundant, in other words the component can be removed and the system should continue to operate as expected. This creates a set of challenges that raise complexity of such systems to a whole different level. Specifically, replicated databases have to deal with the fact that they require maintenance and administration of several servers instead of just one. Moreover, as servers are cooperating together to create the group several other classic distributed systems problems have to be dealt with, such as network partitioning or split brain scenarios.


Therefore, the ultimate challenge is to fuse the logic of the database and data replication with the logic of having several servers coordinated in a consistent and simple way. In other words, to have multiple servers agreeing on the state of the system and the data on each and every change that the system goes through. This can be summarized as having servers reaching agreement on each database state transition, so that they all progress as one single database or alternatively that they eventually converge to the same state. Meaning that they need to operate as a (distributed) state machine.


MySQL Group Replication provides distributed state machine replication with strong coordination between servers. Servers coordinate themselves automatically when they are part of the same group.

相关内容

热门资讯

美威胁袭伊基础设施,伊朗军方:... △当地时间21日,船只在霍尔木兹海峡航行伊朗武装部队哈塔姆安比亚中央总部当地时间22日发布声明称,美...
扑翼机器人问世:像潜水鸟一样在... 潜鸟、海鸥、海鹦和海燕,是自然界中约100种既能飞行又能游泳的鸟类。这些潜水鸟能够俯冲入水追逐猎物,...
当科学家走进西部脑谷:这里有望... 7月22日,2026天府科学家创新发展大会暨成都科产融合对接活动锦江经开区脑机接口专场在锦江区成功举...
女子身份证丢失后名下出现“吸毒... 四川籍的庞女士定居浙江宁波多年,她怎么也没想到,因丢失身份证一事,竟让她陷入长达7年“自证清白”的困...
省农科院成功研发我省首个高粱全... 近日,记者从省农科院获悉,该院作物资源研究所、农业生物技术研究所联合石家庄博瑞迪生物,成功研制出省内...
消息称AMD与Anthropi... IT之家 7 月 22 日消息,据华尔街日报消息,AMD 与 Anthropic 达成了一项价值数百...
独家!苹果iPhone18系列... 7月22日,中国证券报记者从产业链人士处独家获悉,进入7月,苹果iPhone 18系列手机已在量产,...
29岁的党鑫蕊倒在广西泥泞山路... 7月11日晚一通叮嘱,成了父子最后的对话;几天后父亲在殡仪馆见到一身泥的儿子,才知道“他走得有多难。...
时隔一年,英国国防大臣斯特里廷... 一年前,当时还是英国卫生大臣的韦斯·斯特里廷(Wes Streeting)曾公开指责以色列犯下战争罪...
微软与Mistral宣布扩大战... 【CNMO科技消息】7月22日,据韩媒报道,微软与法国AI企业Mistral正式宣布大幅扩大双方战略...