当前位置:网站首页>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
边栏推荐
- 2021 RoboCom 世界机器人开发者大赛-高职组初赛
- 每日三题 6.30
- Notes on problems - /usr/bin/perl is needed by mysql-server-5.1.73-1 glibc23.x86_ sixty-four
- Glass mosaic
- [applet] realize the left and right [sliding] list through the scroll view component
- The difference between timer and scheduledthreadpoolexecutor
- CKS CKA ckad change terminal to remote desktop
- Switch to software testing, knowing these four points is enough!
- Yoga27 multidimensional all-in-one computer with excellent appearance and high-end configuration
- Distance measurement - Hamming distance
猜你喜欢

Stm32f030f4 drives tim1637 nixie tube chip

Yunxin small class | common cognitive misunderstandings in IM and audio and video

Three development trends of enterprise application from the perspective of the third technological revolution

Practical application and extension of plain framework

The best smart home open source system in 2022: introduction to Alexa, home assistant and homekit ecosystem

建模和影视后期有什么关联?

Zhongang Mining: it has inherent advantages to develop the characteristic chemical industry dominated by fluorine chemical industry

Glass mosaic

问题随记 —— file /usr/share/mysql/charsets/README from install of MySQL-server-5.1.73-1.glibc23.x86_64 c

Matplotlib common settings
随机推荐
Practical application and extension of plain framework
【微服务|Sentinel】sentinel整合openfeign
CADD course learning (3) -- target drug interaction
Experience of practical learning of Silicon Valley products
建模和影视后期有什么关联?
MySQL -- convert rownum in Oracle to MySQL
Matplotlib common settings
2022年起重机司机(限桥式起重机)考试试题及模拟考试
notBlank 和 notEmpty
SWT / anr problem - SWT causes kernel fuse deadlock
Linux基础 —— CentOS7 离线安装 MySQL
Timer和ScheduledThreadPoolExecutor的区别
What professional classification does the application of Internet of things technology belong to
【必会】BM41 输出二叉树的右视图【中等+】
Typescript enumeration
Glass mosaic
dat.GUI
2022 examination questions and online simulation examination for safety management personnel of hazardous chemical business units
2021 RoboCom 世界机器人开发者大赛-高职组复赛
玻璃马赛克



