MySQL standby, the main bulk operations when data repository, and how to prevent inconsistencies library prepared solutions (including analysis of ideas and solutions)

Now more commonly used MySQL standby program, a main library for reading and writing, prepare a library for reading, you can quickly solve some database performance issues,

But also it increases the standby operation and maintenance costs, operation and maintenance of the primary and to share some tips below:

First, when the operation of the master batch data library, the library will often prepared synchronization failure or inconsistencies

Positioning method:

Mainly by SHOW SLAVE STATUS; command to locate the problem.

1. Preparation of the library is determined whether the normal sync

These two values ​​are Yes, it represents the synchronization is normal. If NO Slave_SQL_Running value, expressed synchronization fails, refer to the second dot to continue the investigation.

 

2. If not normal, error investigation

Last_Errno and Las_Error displays specific SQL error

 

3. Is there a look synchronization delay

Seconds_Behind_Master:备SQL线程和主I/O线程之间的时间差距,单位以秒计。值为0表示没有延迟。

 

Solution:

mysql> slave stop;

mysql> set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;

mysql> slave start;

 

Guess you like

Origin blog.csdn.net/jlq_diligence/article/details/90597123