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
mysql installer community 8.0.16.0 installation g...
Table of contents Preface Quick Review: JavaScrip...
Preface The electricity in my residence has been ...
Today I will share with you a source code contain...
Because the Raspberry Pi is based on ARM architec...
The relationship between Javascript and DOM is ve...
There are three types of virtual hosts supported ...
illustrate DML (Data Manipulation Language) refer...
1. Demand The local test domain name is the same ...
Database application is an indispensable part of ...
1. Add a comment block at the beginning of the sty...
Introduction MySQL provides an EXPLAIN command th...
Use CSS to modify the browser scroll bar style ::...
Special symbols Named Entities Decimal encoding S...
1. Download the tomcat compressed package from th...