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

A simple understanding of master-slave synchronization in MySQL

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

MySQL master-slave synchronization simple understanding of many large websites in order to reduce the performance problems of a large number of users to the server concurrent visits, will use a lot of solutions, database master-slave separation is a mainstream solution at present. Consider that every user invokes server data through the business layer of the control layer. it is easy to say that the number of users is small, the user experience is very poor if the number of users is large, and the database crashes or even data loss is serious. How to solve the problem, one of the solutions is to separate the master from the slave. To make a long story short, I can't handle a server so I can use several servers, but these servers are divided into primary and secondary and responsibilities. * put our read and write operations on the database to different server clusters. * generally, the master server is responsible for writing and the slave server is responsible for reading. * the operations done by the master server are synchronized to the slave server. * Master / slave configuration only needs to configure the database, and there is no need to modify the business code.

So let's talk about how it works, as shown in the figure:

1. The master server (Master) stores the data information (Data changes) in the binary log (Binary log) 2. From the server, start an Ithumb O thread to connect to the master / slave server and copy / synchronize the operations of the master server. 3. Synchronize these operations to the mediation log (Relay log) 4. Repeat the operation of the master server (Replay / Read) from the server to execute the synchronization operation of the master server step by step, which can be compared to the producer-consumer case, so you need to synchronize to the step-by-step synchronization in the slave server log. The above is my personal beginner's understanding, if there is something wrong, please be sure to point out. The picture comes from some materials of Muk.com.

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