当前位置:网站首页>Redis master-slave synchronization
Redis master-slave synchronization
2022-07-01 23:28:00 【Mar, LiuNian】
List of articles
Concept
runID every last redis The unique identifier of the instance , I don't know the other side runID with ? Instead of
offset Replication progress -1 Represents the first copy
The first master-slave synchronization
Sent by from instance pysnc Tell the primary instance to connect for the first time
The primary instance will offset, and runID Send to slave Library
The main instance passes bgsave Generate the full amount RDB, Generate RDB Operation commands during and after are written to repl buffer
take RDB Send to the slave instance
Finish executing from the instance RDB after , The main instance will then repl buffer Send to the slave instance
Recovery process of master-slave network flash outage ( Incremental replication )
There is a ring buffer on both the master instance and the slave instance (repl_back_log)
In the main instance repl_back_log Record where you write
From the example repl_back_log Record where you read
Every time the main instance executes a command, it will go to repl_buffer,repl_back_log Write records in
When the master and slave restore the connection . From the instance, put your own read location (slave_repl_offset) Send to primary instance
The main instance writes according to its location (master_repl_offset), Find the missing data from the instance (master_repl_offset - slave_repl_offset Interval data ) Send to slave instance synchronization
Master slave cascade
In a master-slave mode , If the data is synchronized by the primary instance , The main instance bears great pressure
At this time, some synchronization tasks can be handed over to the first synchronized instance to synchronize to the unsynchronized instance .
Compare the main instance to the boss , From example to employee , The boss should assign tasks to employees one by one
But if the employee is promoted to ( The general manager , President ), Then the boss assigns the task to it two , It is then allocated to employees , This will reduce the pressure of the boss
matters needing attention
because repl_back_log It's a ring buffer
The ring buffer will start overwriting data after one cycle of writing
If the write speed of the master instance is faster than the read speed of the slave instance , It may cause the data that has not been read from the instance to be overwritten by the newly written operation of the master instance
Therefore, it is important to set the size of the ring buffer reasonably (repl_backlog_size)
Check the following information , Generally set to ( Main instance write command speed * Operation size - Master slave network transmission command speed * Operation size ) * 2
边栏推荐
- The digital summit is popular, and city chain technology has triggered a new round of business transformation
- [micro service sentinel] sentinel integrates openfeign
- Y53. Chapter III kubernetes from introduction to mastery -- ingress (26)
- SWT/ANR问题--SWT 导致 low memory killer(LMK)
- STM32F030F4驱动TIM1637数码管芯片
- [swoole Series 1] what will you learn in the world of swoole?
- 认识线程
- 2021 RoboCom 世界机器人开发者大赛-高职组初赛
- Redis 主从同步
- flutter Unable to load asset: assets/images/888.png
猜你喜欢

【微服务|Sentinel】sentinel整合openfeign

什么是马赛克?

Win 10 mstsc connect RemoteApp

2022年最佳智能家居开源系统:Alexa、Home Assistant、HomeKit生态系统介绍

Notes to problems - file /usr/share/mysql/charsets/readme from install of mysql-server-5.1.73-1 glibc23.x86_ 64 c

Aaai22 | structural tagging and interaction modeling: a "slim" network for graph classification

字典、哈希表、数组的概念

Huisheng Huiying 2022 intelligent, fast and simple video editing software

Redis~02 cache: how to ensure data consistency in MySQL and redis when updating data?

flutter Unable to load asset: assets/images/888. png
随机推荐
神经网络物联网的发展趋势和未来方向
从第三次技术革命看企业应用三大开发趋势
dat.GUI
Postgresql随手记(10)动态执行EXECUTING语法解析过程
2022 R1 fast opening pressure vessel operation test questions and answers
Behind sharing e-commerce: the spirit of CO creation, symbiosis, sharing, CO prosperity and win-win
Understanding threads
Istio, ebpf and rsocket Broker: in depth study of service grid
玻璃马赛克
"35 years old, the boss of the company, with a monthly salary of 20000, give away takeout": the times abandoned you, not even saying goodbye
Matplotlib常用图表
【微服务|Sentinel】SentinelResourceAspect详解
每日三题 6.30
马赛克后挡板是什么?
Jielizhi Bluetooth headset quality control and production skills [chapter]
Which securities company is better and which is safer to open a securities account
每日三题 6.29
想请教股票开户要认识谁?在线开户是安全么?
2021 RoboCom 世界机器人开发者大赛-高职组复赛
2022 safety officer-c certificate examination question simulation examination question bank and simulation examination



