当前位置:网站首页>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
边栏推荐
- Future trend and development of neural network Internet of things
- 图的遍历之深度优先搜索和广度优先搜索
- What are the common types of points mall games?
- Stm32f030f4 drives tim1637 nixie tube chip
- Distance measurement - Hamming distance
- Airserver latest win64 bit personal screen projection software
- What professional classification does the application of Internet of things technology belong to
- Linux foundation - centos7 offline installation of MySQL
- 证券开户选哪个证券公司比较好,哪个更安全
- sql 优化
猜你喜欢
SWT / anr problem - SWT causes kernel fuse deadlock
Experience of practical learning of Silicon Valley products
Zhongang Mining: it has inherent advantages to develop the characteristic chemical industry dominated by fluorine chemical industry
物联网技术应用属于什么专业分类
from pip._internal.cli.main import main ModuleNotFoundError: No module named ‘pip‘
CADD课程学习(3)-- 靶点药物相互作用
Zero foundation tutorial of Internet of things development
CADD course learning (3) -- target drug interaction
STM32F030F4驱动TIM1637数码管芯片
2022 safety officer-c certificate examination question simulation examination question bank and simulation examination
随机推荐
JS - use of arguments
Know --matplotlib
Notes on problems - /usr/bin/perl is needed by mysql-server-5.1.73-1 glibc23.x86_ sixty-four
Linux foundation - centos7 offline installation of MySQL
Experience of practical learning of Silicon Valley products
力扣今日题-241. 为运算表达式设计优先级
字典、哈希表、数组的概念
Applet form verification encapsulation
Who do you want to know when opening a stock account? Is it safe to open an account online?
Practical application and extension of plain framework
想请教股票开户要认识谁?在线开户是安全么?
云信小课堂 | IM及音视频中常见的认知误区
Microservice stability management
The digital summit is popular, and city chain technology has triggered a new round of business transformation
[micro service sentinel] @sentinelresource details
Matplotlib common charts
What is mosaic?
[swoole Series 1] what will you learn in the world of swoole?
flutter Unable to load asset: assets/images/888. png
Linux基础 —— CentOS7 离线安装 MySQL