当前位置:网站首页>主从复制及其原理
主从复制及其原理
2022-07-29 01:58:00 【Meme_xp】
Redis的复制功能是支持多个数据库之间的数据同步。主数据库可以进行读写操作,当主数据库的数据发生变化时会自动将数据同步到从数据库。从数据库一般是只读的,它会接收主数据库同步过来的数据。
1.当启动一个从节点时,它会发送一个PSYNC命令给主节点;
2.如果是从节点初次连接到主节点,那么会触发一次全量复制。此时主节点会启动一个后台线程,开始生成一份RDB快照文件;
3.同时还会将从客户端client新收到的所有写命令缓存在内存中。RDB文件生成完毕后,主节点会将RDB文件发送给从节点,从节点会先将RDB文件写入本地磁盘,然后再从本地磁盘加载到内存中;
4.接着主节点会将内存中缓存的写命令发送到从节点,从节点同步这些数据;
5.如果从节点跟主节点之间网络出现故障,连接断开了,会自动重连,连接之后主节点仅会将部分缺失的数据同步给从节点。
边栏推荐
- 记一次 ERROR scheduler.AsyncEventQueue: Dropping event from queue shared导致OOM
- [upload picture 2-cropable]
- 3D模型格式全解|含RVT、3DS、DWG、FBX、IFC、OSGB、OBJ等70余种
- The outsourcing company "mixed" for two years, and I only did five things seriously. Now I get byte offer smoothly.
- 高效使用浏览器的5个小技巧,第1个技巧最实用
- Kubesphere multi node installation
- 如何把thinkphp5的项目迁移到阿里云函数计算来应对流量洪峰?
- How does the Devops team defend against API attacks?
- 4年测试经验,好不容易进了阿里,两个月后我选择了裸辞...
- 如何利用 RPA 实现自动化获客?
猜你喜欢

多线程浅谈

如何把thinkphp5的项目迁移到阿里云函数计算来应对流量洪峰?

I want to talk about high concurrency.

记一次 ERROR scheduler.AsyncEventQueue: Dropping event from queue shared导致OOM

会议OA之会议通知

Never pass a request to an asynchronous thread. There is a hole

Servlet三种实现方式
[email protected] The localization rate reaches 100%"/>Quanzhi t3/a40i industrial core board, 4-core [email protected] The localization rate reaches 100%

Responsive dream weaving template hotel room website

Explain asynchronous tasks in detail: task status and lifecycle management
随机推荐
一文理解分布式开发中的服务治理
响应式织梦模板化妆美妆类网站
Installation guide for proftpd Secure FTP server with TLS encryption enabled
How to use RPA to achieve automatic customer acquisition?
记一次 ERROR scheduler.AsyncEventQueue: Dropping event from queue shared导致OOM
On Multithreading
Servlet三种实现方式
What is scope and scope chain
开启TLS加密的Proftpd安全FTP服务器安装指南
多边形点测试
Meeting notice of meeting OA
How awesome is the architecture of "12306"?
Website Collection
ES2022 的 8 个实用的新功能
【golang学习笔记2.2】 Map、结构体和接口
如何利用 RPA 实现自动化获客?
发布融资需求1.29亿元,大科城项目路演持续浇灌科创“好苗子”
Vector similarity evaluation method
聊聊 Feign 的实现原理
实验二:Arduino的三色灯实验