In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Foreword:
For the same reason as MySQL master-slave replication, although Redis reads and writes very fast, it also produces a particularly high read pressure. In order to share the read pressure, Redis supports master-slave replication. The master-slave structure of Redis can adopt a master with multiple slaves or cascade structure. Redis master-slave replication can be divided into full synchronization and incremental synchronization according to whether it is full or not. The diagram below shows the cascade structure.
1 Total synchronization
Redis full replication generally occurs during the Slave initialization phase, when the Slave needs to make a copy of all the data on the Master. The specific steps are as follows:
1) Slave server connects to master server and sends SYNC command;
2) After receiving the SYNC name, the master server starts to execute the BGSAVE command to generate the RDB file and uses the buffer to record all write commands executed thereafter;
3) After the master server BGSAVE is executed, it sends a snapshot file to all slave servers, and continues to record the executed write commands during the transmission;
4) After receiving the snapshot file from the server, discard all old data and load the received snapshot;
5) After sending the snapshot, the master server starts to send write commands in the buffer to the slave server;
6) The slave server finishes loading snapshots, starts receiving command requests, and executes write commands from the master server buffer;
After completing the above steps, all operations of data initialization from the server are completed, and the slave server can now receive read requests from users.
2 incremental synchronization
Redis incremental replication refers to the process of synchronizing writes that occur on the master server to the slave server when the Slave is initialized and starts working properly.
The incremental replication process is basically that every time the master executes a write command, it sends the same write command to the slave server, and the slave server receives and executes the received write command.
3 Redis master-slave synchronization strategy
When the master and slave are just connected, full synchronization is performed; after full synchronization is completed, incremental synchronization is performed. Of course, slaves can initiate full synchronization at any time if needed. The redis strategy is to try incremental synchronization first anyway, and if unsuccessful, require full synchronization from the slave.
4 Attention points
If multiple Slaves are disconnected and need to be restarted, as long as the Slave starts, it will send sync requests and full synchronization of the host. When multiple Slaves appear at the same time, it may cause a sharp increase in Master IO downtime.
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.