MySQL Master standby switch Walkthrough and summary

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.