???????????????????MySQL????????????????洢????????????????MySQL??HA????????????ò??????????????master???????????????α????????????????????α?????????master????????????????????????????????????ú?????????????????????????????MySQL proxy???toolsets?????????????????????????????????в????MySQL HA??????
????Replication
????????MySQL??????????replication???????????????????MySQL????????????replication????????????????????????????????replication??????asynchronous???????д??????????????????μ?slave???棬????????master??????????????????????????????????
??????????????????????????semi-synchronous replication??semi-synchronous replication???????????master?????????????????????????????semi-synchronous??slave??????????????????д??relay-log????????????????master??????????????slave??????????????????
?????????semi-synchronous??????????????????????master????????????????slave???????????????????????????????????????????????semi-synchronous replication???????????????????????????????????????MHA??????????????facebook?????????????????semi-synchronous??????????????????????????????????????????????????????????????????facebook????google??????????????????????MySQL 5.7???????????Loss-Less Semi-Synchronous replication????????????????????С???
??????????????????????????????????????????????gelera?????MySQL???????????????????д???????????????????????????????κ????gelera????飬?????????????й???????????????????У???????????????????gelera??MySQL????????????????????Щ?д???????????????????:-)
????????????????drbd?????MySQL????????MySQL??????????????????????????????δ?????????????MHA??????д???Щ????drdb?????????????????ο???
???????????????У?????????????semi-synchronous replication???????????????????????????????????gelera??
????Monitor
?????????????????replication?????????master???????????????????????????????????master????????????????????????????????????????????????
??????master???????monitor???????????????????????????????????????????????????????failover??
???????????????????????????????keepalived????heartbeat????????????master???????????????????л??????????檔???????????????????????????á??????????????????keepalived??????????????????????????zookeeper?????????MySQL?????monitor???failover??
?????????κ????MySQL????????????????????agent????agent????MySQL????????????????棬?????????MySQL???????ping??????????????????agent???ephemeral?????????zookeeper???檔??????????????????MySQL????????????????????????
??????????????????MySQL???agent???????agent??zookeeper??????????
????MySQL?????agent????ping??????????????zookeeper??????
????Agent???????MySQLδ??
?????????????????????????????MySQL??????????????????zookeeper????????????agent??zookeeper??????????zookeeper?????????children changed????????????????????????????????????????????????????????????????????????failover???????????????????????????????????????crontab????supersivord???????????????agent??
???????zookeeper????????????????????????????м??????????????????????仯???????????????????????????????Э???????????????????????Щ??keepalived????heartbeat??????????????????鷳???
???????zookeeper????????????????????????????????????failover?????????ó????????μ??????????????????鷳??????
??????????????????????????MySQL???????agent??????????????docker??????????????????????????????????????????????????????zookeeper????е?????????????????????????????VIP?????????proxy???????
???????zookeeper????????????????????????????????master?????slave??zookeeper????????????????keepalived?????
????Failover
???????monitor?????????????????MySQL????????MySQL???????????????????failover????????????????????????MySQL?????a?master??b??c???slave????a????????????????failover????????????b??c?е??????????μ?master???
????????????????slave??н?????master???????????????μ?master????????????show slave status?????????????????slave????μ???????????????????????????Master_Log_File???Read_Master_Log_Pos???????????????slave?????master?????binlog??????????λ???binlog????????????pos??????????slave??????????master?????????????????slave??????????master???????
???????????????У?????b???????master????????????c????????μ?master b?????????????????CHANGE MASTER TO??????????c??master???????????????????b??binlog?????????????????position??????????
????GTID
??????????????????MySQL 5.6?????????GTID???????uuid:gid??uuid?MySQL server??uuid???????????gid?????????????????id?????????????????????????????????binlog?е????????GTID??????????????????failover??????
??????????????????????b??????????a?????GTID?3E11FA47-71CA-11E1-9E33-C80AA9429562:23????c???3E11FA47-71CA-11E1-9E33-C80AA9429562:15????c????μ?master b????????????GTID?????????????b?е?binlog?????GTID?3E11FA47-71CA-11E1-9E33-C80AA9429562:15???event?????c??????????????event??λ??????????????????binlog?????????????????????Ч?????????????????????2??????filename??position?????????????
????google????????????Global Transaction ID??????????????????????????????Σ?LedisDB??????????·?????failover???????googleò????????????????MariaDB????????
????MariaDB??GTID????MySQL 5.6???????????????????鷳?????????MySQL?????go-mysql???????ζ???д?????????????????GTID??????????????????MariaDB???????ɡ?