DB Role Switch¶
Archived (pre-2022)
Preserved for reference only -- likely outdated. View original | Last updated: January 2017
Software¶
The software used for assigning a role with the Main MySQL "Cluster" consist of these parts:
- MHA (MySQL Master HA)
- switch_lib - custom bash library with common switching tasks
- master_switch - custom bash script for initiating a master switch
- statsdb_switch - custom bash script for initiating a statsdb or statsdb2 switch
All software is installed on all dbs00[1-5] servers by the mha4mysql cookbook.
Not automated¶
It's important to know that there is no automated failover or role switch in any case.
It was planned at one time (the use of MHA stems from that) but the idea was later abandoned. The main reasoning is that not having automated failover might cause longer downtime in case of a server crash. Having an unplanned failover at the wrong time however might cause not only downtime but data loss as well.
Given that we had a single crash in the past 5 years where automated failover would have prevented extended downtime, but countless incidents where high server load might have caused an unintended failover it was decided that the additional manual step provides less risk.
Usage¶
For usage see: