Mysql master-slave switchover steps

Source: Internet
Author: User

Mysql master-slave switchover steps

1> normal switchover

1) Check the output of the show processlist statement from the server until you see Has read all relaylogwaiting for the slave I/O thread to update it

2) Make sure that the slave server has processed all the statements in the log. Mysql> stop slave IO_THREAD

After the slave server completes these operations, they can be reconfigured as a new setting.

3) The stop slave, reset master, and reset slave operations are performed on the SLAVE server promoted to the MASTER server.

4) Then restart the mysql service.

5) create A user grant replication slave on *. * torepdcs @ 'IP of a' identified by 'replpwd' on the slave server (new master server'

Grant allprivileges on *. * to 'repdcs '@ 'IP' identified by replpwd;

6) RESET the MASTER on the MASTER server. Then change master TOMASTER_HOST = 'original slave server IP ', MASTER_USER = 'username', MASTER_PASSWORD = 'Password', master_log_file = 'master-bin.000015 ';

7) view the status show slave status \ G;

Show master status \ G;

If not, restart the MASTER database again and execute change master TOMASTER_HOST = '2017. 168.0.110 ', MASTER_USER = 'repdcs', MASTER_PASSWORD = '000000', master_log_file = 'mysqlbin. 000002 ';

8) modify the application connection address to the new master database.

Switch complete.

2> direct host downtime

1> execute stop slave and reset master on the SLAVE machine

2> View show slave status \ G;

3> modify the connection address of the application.

Generally, most of the switches to direct down hosts are unable to provide services.

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.