The walkthroughs include both passive switching and active switching. Passive switching is the main library outage, the active switch is manually triggered by manual.
The walkthrough steps are roughly as follows:1 First stop the main library, simulate the main library down 2 MHA the VIP to the standby library, the repository becomes the main library, the application can read and write the database 3 Restart the downtime of the original library 4 to establish a synchronization relationship on the primary repository (according to the downtime, the log records of the Binlog file name and offset, recovery from here) 5 MHA Manually switch the main library, restore to the original state, the application can read and write database 6 walkthrough End
Summary of Walkthrough process issues:1 MHA after each automatic switchover will end itself process, and in the log directory, such as/app/mha/xxx/to generate a success or failure token (sys.failover.complete/error), the next time to start the MHA before you want to remove these tag files, Otherwise MHA will not start normally, because these tag files, MHA think has switched to end 2 database host switchover rigorous practice is to set master to read-only, then set Master_log_file and Master_log_pos, and finally start replication 3 MHA Manual switch To specify the port, otherwise only the IP will be MHA think that there is no surviving 4 database master/slave library to configure/etc/sudoersdefault Requiretty to comment out (to resolve "Sorry, you must have a terminal to perform sudo" warning) 5 Error Happened on monitoring servers The problem is that the MySQL map is not found, add a soft connection to
Common MHA directives:1 Check MHA ssh-free login status
Masterha_check_ssh--conf=/etc/mha/sys/sys.cnf
2 Checking the operating status of the MHA
Masterha_check_status--conf=/etc/mha/sys/sys.cnf
3 Checking the replication of the master standby library
Masterha_check_repl--conf=/etc/mha/sys/sys.cnf
4 Stop MHA
Masterha_stop--conf=/etc/mha/sys/sys.cnf
5 Start MHA
Nohup Masterha_manager--conf=/etc/mha/sys/sys.cnf > Sys.log 2>&1 &
6 MHA Manually switch the main library
Masterha_master_switch--conf=/etc/mha/sys/sys.cnf--master_state=alive--new_master_host=10.138.16.133--new_ master_port=3104--orig_master_is_new_slave
7 MHA Database instance re-bound
Sudo/etc/mha/sys/master_ip_failover--command=status--ssh_user=xxxadmin--orig_master_host=10.138.16.133--orig_ master_ip=10.138.16.133--orig_master_port=3104
MySQL Master standby switch Walkthrough and summary