当前位置:网站首页>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
边栏推荐
- 小程序表单校验封装
- ShanDong Multi-University Training #3
- Create Ca and issue certificate through go language
- 物联网开发零基础教程
- Concepts of dictionary, hash table and array
- The online beggar function of Japanese shopping websites
- Daily three questions 6.28
- Glass mosaic
- MySQL binlog cleanup
- Future trend and development of neural network Internet of things
猜你喜欢

Win 10 mstsc connect RemoteApp

notBlank 和 notEmpty

flutter Unable to load asset: assets/images/888.png

2021 RoboCom 世界机器人开发者大赛-高职组复赛

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

Notes on problems - /usr/bin/perl is needed by mysql-server-5.1.73-1 glibc23.x86_ sixty-four

What professional classification does the application of Internet of things technology belong to

2022年R1快开门式压力容器操作考题及答案

SWT / anr problem - SWT causes kernel fuse deadlock

什么是马赛克?
随机推荐
flutter Unable to load asset: assets/images/888.png
物联网应用技术专业是属于什么类
What is the mosaic tailgate?
Why is PHP called hypertext preprocessor
内存泄露和内存溢出的区别是什么?
软件架构的本质
MySQL -- convert rownum in Oracle to MySQL
ShanDong Multi-University Training #3
2022 R1 fast opening pressure vessel operation test questions and answers
Leetcode(34)——在排序数组中查找元素的第一个和最后一个位置
上海炒股开户选择手机办理安全吗?
【小程序】通过scroll-view组件实现左右【滑动】列表
Create Ca and issue certificate through go language
Zhao Fuquan: to ensure supply in the short term, we should build a safe, efficient and resilient supply chain in the long term
What professional classification does the application of Internet of things technology belong to
[LeetCode] 最后一个单词的长度【58】
notBlank 和 notEmpty
共享电商的背后: 共创、共生、共享、共富,共赢的共富精神
Glass mosaic
Current situation and future development trend of Internet of things



