???????????????????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??????????