In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the working principle of master-slave replication in Redis, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Master-slave replication:
1. The replication function of redis is to support data synchronization between multiple databases. One is the master database (master) and the other is the slave database (slave). When the write operation occurs, the master database can automatically synchronize the data to the slave database, while the slave database is generally read-only and receives the data synchronized from the master database. A master database can have multiple slave databases, while a slave database can only have one master database.
2. Through the replication function of redis, the read and write separation of the database can be realized, and the load capacity of the server can be improved. The master database is mainly for write operations, while the slave database is responsible for read operations.
A summary of how Redis replication works is as follows:
1. If a Slave is set, it issues a SYNC command whether it connects for the first time or reconnects to the Master
two。 When Master receives the SYNC command, it does two things:
A) Master executes BGSAVE, that is, saving data to disk in the background (rdb snapshot file)
B) Master also buffers newly received commands for writing and modifying datasets (non-query class)
3. When Master saves the data to the snapshot file in the background, Master transfers the snapshot file to Slave, and Slave clears the memory and loads the file into memory
4. And Master will also forward the commands previously collected into the buffer to Slave,Slave to execute these commands in the form of Reids command protocol to achieve synchronization with Master.
5. Since then, Master/Slave will continue to synchronize commands asynchronously to achieve the same synchronization of the final data.
6. It should be noted that any reconnection between Master and Slave will trigger a full synchronization operation. However, after 2.8, it may also be a partial synchronization operation.
About the working principle of master-slave replication in Redis is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.