(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