ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

说MGR - MGR的基本原理

2019-09-14 10:01:46  阅读:247  来源: 互联网

标签:分发 事务 基本原理 数据库 servers 状态机 MGR 分布式


状态机复制


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.

标签:分发,事务,基本原理,数据库,servers,状态机,MGR,分布式
来源: https://blog.51cto.com/coveringindex/2437917

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有