MHA とは
MHAとは MySQL のマスタ障害時に最新のス
レーブをマスタとして他のスレーブの差分を
補完しマスタの向き先を変えてくれるプロダ
クト。 replication の復旧を自動的にしてくれ
るもの。
VIP を移動するのは自己責任。
MHA for MySQL は Master High Availability
Manager and tools for MySQL の略らしいです。
作者の日本語スライド
http://www.slideshare.net/matsunobu/mha-for-mysqlden
DB の負荷分散と冗長化の構成
Before
LVS で分散してHertbeatV1+mon+mysql で冗長
化
LVS1LVS
DB
Master
Hertbeat1
+mon
DB
Slave2
DB
Slave1
Hertbeat1
VIP
webwebwebwebwebweb
write
read
repl
read
repl
5.
DB の負荷分散と冗長化の構成
Before
Failover すると、マスタ1 台になってしまう
。
LVS1LVS
DB
Master
Hertbeat1
+mon
DB
Slave
DB
newMaster
Hertbeat1
VIP
webwebwebwebwebweb
write
read
repl
read
repl
×
×
×
×
6.
DB の負荷分散と冗長化の構成
After
LVS で分散してMHA+mysql で冗長化
※manager は Admin サーバと相乗り
LVS1
DB
Master
MHAnode
Admin
MHA
manager
DB
Slave
MHAnode
DB
Slave
MHAnode
VIP
webwebwebwebwebweb
write
read
repl
repl
read
LVS
chk
7.
DB の負荷分散と冗長化の構成
After
Failoverすると、 replicaiton も再構成され
る
LVS1
DB
Master
MHAnode
Admin
MHA
manager
DB
newMaster
MHAnode
DB
Slave
MHAnode
VIP
webwebwebwebwebweb
write
read
repl
read
LVS
※ 切り替えた後に
、
manager も落ちま
す