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

How does MySQL replication work?

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

Share

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

Today, I will talk to you about the working principle of MySQL replication, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

How MySQL replication works can be divided into three steps:

1. The master server records data updates to the binary log

two。 The slave server copy the binary log of the master server to its own relay log (Relay Log).

3. Redo the time in the relay log from the server and apply the update to your own database

There are two threads in the slave server, one is the Icano thread, which is responsible for reading the binary log on the master server and saving it as a relay log

The other is the SQL thread, which is responsible for copying the contents of the execution relay log.

Innodb has a total of four log types, which are briefly introduced as follows:

1. Error log: record error messages, as well as some warnings or correct information

two。 Slow log: set a threshold to record all SQL statements that run longer than this value in the slow log file

3. Binary log: records all actions that make changes to the database

4. Query log: records all requests to the database, regardless of whether they are executed correctly or not

The storage form of the log

Isolation: achieved through locks

Atomicity, consistency, and persistence are accomplished through redo and undo

After reading the above, do you have any further understanding of how MySQL replication works? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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