MySQL HA 與 Slave 的關係

上面一篇「MySQL HA」其實是要提 Mark Callaghan 所寫的「Global transaction IDs are hot」這篇文章。

在三種架構下,DRBD + Heartbeat 的系統要加掛 slave 是最容易的,因為 master server 雖然跳動,但 replication 位置不會變。

在 Master-Master 架構下,由於兩台 master 都有自己的 binlog,會使得 master 跳動時 slave 產生問題,也就是在 Mark Callaghan 文章裡所寫的三種解法 "switch and hope"、"check and lose"、"check and fix"。

這三種解法都並沒有很完滿的解決問題 (第三種解法雖然看起來有 "fix",但是透過工人智慧手動解決)。

一種方法是引入 Global transactions IDs,這是由 Google 提出的 patch:「MySQL Hierarchical Replication & Global Group IDs」,對 binlog 每筆 transaction 都加上一組 64bits 且遞增的數字,這樣 slave 就不會受到 master 切換而產生 replication err。

先記錄下來,之後很有可能會透過 Google 又找到自己寫的文章...

Update:看到「High Availability for MySQL: Considering the Options」這篇文章,要如何做 HA。

Leave a Reply

Your email address will not be published. Required fields are marked *