溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

說MGR - MGR的基本原理

發(fā)布時間:2020-06-04 13:20:28 來源:網(wǎng)絡(luò) 閱讀:1198 作者:coveringindex 欄目:MySQL數(shù)據(jù)庫

狀態(tài)機(jī)復(fù)制


MGR本質(zhì)上一個狀態(tài)機(jī)復(fù)制的集群。在狀態(tài)機(jī)復(fù)制的架構(gòu)中,數(shù)據(jù)庫被當(dāng)做一個狀態(tài)機(jī)。每一次寫操作都會導(dǎo)致數(shù)據(jù)庫的狀態(tài)變化。為了創(chuàng)建一個高可用的數(shù)據(jù)庫集群,有一個組件,即事務(wù)分發(fā)器,將這些操作按照同樣的順序發(fā)送到多個初始狀態(tài)一致的數(shù)據(jù)庫上,讓這些數(shù)據(jù)庫執(zhí)行同樣的操作。因為初始狀態(tài)相同,每次執(zhí)行的操作也相同,所以每次狀態(tài)變化后各個數(shù)據(jù)庫上的數(shù)據(jù)保持一致。



分布式的狀態(tài)機(jī)復(fù)制


事務(wù)分發(fā)器是一個單點,為了避免單點故障,可以采用分布式的狀態(tài)機(jī)復(fù)制。在分布式的狀態(tài)機(jī)復(fù)制中,有多個事務(wù)分發(fā)器,它們彼此互相通信。事務(wù)分發(fā)器可以同時接收事務(wù)請求,就像單個事務(wù)分發(fā)器同時接收事務(wù)請求一樣。從應(yīng)用層來說,并發(fā)的事務(wù)發(fā)到同一個事務(wù)分發(fā)器和發(fā)到不同的事務(wù)分發(fā)器上效果是一樣的。事務(wù)分發(fā)器之間會互相通信,把所有的事務(wù)匯總、排序。最終,每個事務(wù)分發(fā)器上都有一份完整的排好序的事務(wù)請求。每個事務(wù)分發(fā)器只連接到一個數(shù)據(jù)庫上,并負(fù)責(zé)把事務(wù)請求依次發(fā)送到相連的數(shù)據(jù)庫上去執(zhí)行,其就是一個分布式狀態(tài)機(jī)復(fù)制的模型了。



分布式的高可用數(shù)據(jù)庫


將分布式的事務(wù)分發(fā)模塊集成到數(shù)據(jù)庫系統(tǒng)中,就變成了一個分布式的高可用數(shù)據(jù)庫系統(tǒng)。用戶通過數(shù)據(jù)庫的用戶接口執(zhí)行事務(wù)。數(shù)據(jù)庫收到事務(wù)請求后,首先交由事務(wù)分發(fā)模塊處理。事務(wù)分發(fā)模塊將事務(wù)匯總排序,然后依次交由數(shù)據(jù)處理模塊去執(zhí)行這些事務(wù)。如果去掉內(nèi)部的細(xì)節(jié),就會發(fā)現(xiàn)這是一個非常簡潔的數(shù)據(jù)庫集群方案。MGR就是這樣一個分布式的高可用MySQL系統(tǒng)。



品味來自官檔的一段話~


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.

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI