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

Full replication and partial replication of redis master-slave replication

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

Share

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

I. what is the matter of full replication or partial replication?

Full replication: generally used in the initial replication scenario. The only replication feature supported by Redis in the early days is full replication, which sends all the data of the master node to the slave node at once. When the amount of data is large, it will cause great overhead to the master and slave nodes and the network.

Partial replication: used to deal with data loss scenarios caused by network flash breaks in master-slave replication. When the slave node is connected to the master node again, if conditions permit, the master node will reissue the lost data to the slave node. Because the reissued data is far less than the full data, the excessive overhead of full replication can be effectively avoided.

Partial replication is a major optimization of the old version of replication, effectively avoiding unnecessary full copy operations.

Second, the logic of full replication

When the redis service node starts, a run_id identity is generated (the run_id changes when the service is restarted). The slave node remembers the run_id of the master node, and when it is found that the run_id of the master node occurs in the process of copying the master node, it will be fully replicated.

Get to know run_id

Info server#

III. The logic of partial replication

Partial replication is the replication offset.

By comparing the replication offset of master-slave nodes, we can judge whether the data of master-slave nodes are consistent or not.

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