Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to the principle of MySQL Master-Slave synchronization

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "introduction of the principle of MySQL master-slave synchronization". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the introduction of the principle of MySQL master-slave synchronization".

The principle of master-slave synchronization:

1. There is an IO thread on the master database, and an IO thread and an SQL thread on the slave database. The IO thread in the slave database is responsible for reading the binlog from the master database and writing the relay log of the slave database. The SQL thread is responsible for reading and executing the binlog in the relay log, and applying the database summary after converting the sql statement.

2. The communication is:

① sends a synchronization request to the master database from the IO thread of the library, which contains the user name, password, file name of binlog and pos point.

After the verification of the ② master library is successful, send the binlog log file required by the slave library and the pos point in the binlog file

After receiving from the IO thread of the library, ③ transfers the binlog file to the relay-log file of the relay log, and records the binlog file name and pospoint in the master.info file to facilitate the next communication.

After ④ detects the relay-log file from the SQL thread of the library, converts the relay-log file to the binlog file and executes it locally, and records the relay-log file name and pospoint into the relay-log.info file.

⑤ sends the next round of requests from the library again.

If there is a slave library hanging after slave, open binlog and add a parameter log-slave-updates.

Thank you for your reading, the above is the content of "introduction to the principle of MySQL master-slave synchronization". After the study of this article, I believe you have a deeper understanding of the introduction of the principle of MySQL master-slave synchronization, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report