MySQL Master does not agree on several types of failure summary analysis, resolution and prevention

Source: Internet
Author: User

(1). master-Slave inconsistency failure, from the library down, after starting from the library to write data repeatedly error
Solutions and Prevention:
Relay_log_info_repository=table
(InnoDB)
Parameter explanation Description:
If Relay_log_info_repository is file, when set to 0, to the OS to flush the disk, affected by the parameter sync_relay_log_info, the default is 10,000 flushes to disk;
If relay_log_info_repository is table and stored for InnoDB, the table will be updated each time the event is any value.
Relay_log_info_repository=table can avoid relay.info update is not timely, the SLAVE after restarting the master-slave replication data repeatedly inserted error problem.

To modify a step:
1. Stop slave;
2. Set global relay_log_info_repository= ' TABLE ';
or set in MY.CNF:
Relay_log_info_repository = TABLE


(2). master-Slave inconsistency failure, main library outage
Solutions and Prevention:
Method 1: After the main library is started, the Binlog complete can be

Method 2:innodb_flush_log_at_trx_commit=1
The Innodb_flush_log_at_trx_commit parameter values are described below:
0-Each second synchronizes the modified record to the log (disk), and the commit is not synchronized
1-Each transaction commit synchronizes the modified record to the log (disk)
2-Each transaction commit writes modifications to the operating system cache and then synchronously writes the modified record to the log (disk) every second

Method 3: Application Double Write
Method 4: Application write Log
Method 5:mysql Half-sync (semi sync)


(3). master-Slave inconsistency failure, modified from library data
Usually the error is summarized as follows:
error:1032
The data to be deleted cannot be found from the library
error:1062
A unique conflict occurs when inserting data from a library
error:1452
Unable to insert or update data for a reference primary key in a foreign key table

Solutions and Prevention:
1. Set User permissions
2. Set read-only permissions from the library
Set global read_only=true turn: http://blog.itpub.net/15498/viewspace-2136180/

MySQL Master does not agree on several types of failure summary analysis, resolution and prevention

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.