Online service MySQL master-slave database synchronization inconsistency problem solving

Source: Internet
Author: User

The cause of the problem: the main library has set the parameters from the library replicate_do_db to the library main, and the later application has created the database as middle in the main library, not changing this parameter setting causes the database middle to be synchronized from the library.

Workaround:

A. . backup the database to be synchronized in the main library middle:

/usr/local/mysql/bin/mysqldump-uroot-proot-s/tmp/mysql3307.sock--single-transaction--master-data=2-b Middle > Middle.sql

two . Transfer the backup middle.sql to the slave library.

In the From Library execution:

1.source middle.sql(recovering database from library middle)

2.stop slave sql_thread;

3.CHANGE REPLICATION FILTER replicate_do_db = (main,middle);

4.start slave sql_thread;

three. In order to restart in the future can also take effect, the parameter replicate_do_db and the specified master-slave synchronization of the database is written in the master-slave configuration file.

Pre-operation recommended read Official document:https://dev.mysql.com/doc/refman/5.7/en/change-replication-filter.html

Online service MySQL master-slave database synchronization inconsistency problem solving

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.