1. Phenomenon In the early morning, an index was added to an online table. The amount of data in the table was too large (more than 100 million data, more than 50G of data), causing a delay of several hours between the master and slave. The systems that depended on the slave database were unable to query the data, ultimately affecting the business. Now let's sort out the principle of master-slave delay. 2. Principle According to the description in the MySQL official document MySQL Replication Implementation Details, MySQL master-slave replication relies on three threads: one thread for When the master server and the slave server are connected, create
When the slave server receives the START_SLAVE command, it creates
Note: After the You can view the thread status through SHOW PROCESSLIST: Binlog dump thread: mysql> SHOW PROCESSLIST\G *************************** 1. row *************************** Id: 2 User: root Host: localhost:32931 db: NULL Command: Binlog Dump Time: 94 State: Has sent all binlog to slave; waiting for binlog to be updated Info: NULL I/O thread and SQL thread: mysql> SHOW PROCESSLIST\G *************************** 1. row *************************** Id: 10 User: system user Host: db: NULL Command: Connect Time: 11 State: Waiting for master to send event Info: NULL *************************** 2. row *************************** Id: 11 User: system user Host: db: NULL Command: Connect Time: 11 State: Has read all relay logs; waiting for the slave I/O thread to update it Info: NULL Analysis According to the above principle, since
An index is created here. After consulting the DBA, it is found that the generated 4. Solution From the perspective of the causes of master-slave delay, the solution can be started from the following directions:
Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links You may also be interested in:
|
>>: Solve the cross-domain problem of Vue+SpringBoot+Shiro
byzhangxinxu from https://www.zhangxinxu.com/word...
It is essentially a common js object used to desc...
Use JS to implement a random roll call system for...
Preface The general methods are not listed here, ...
Table of contents Problem Description Rendering T...
1: Download from mysql official website https://d...
1. Ubuntu Server 18.04.5 LTS system installation ...
1. scale() method Zoom refers to "reducing&q...
Table of contents Vue CLI builds a Vue project Vu...
question Recently I encountered a requirement to ...
Click here to return to the 123WORDPRESS.COM HTML ...
The database, like the operating system, is a sha...
Many friends have asked in forums and message are...
Last week, the teacher gave me a small homework, ...
<br />This is a series of tutorials provided...