当前位置:网站首页>什么是RDB和AOF
什么是RDB和AOF
2022-07-06 12:42:00 【51CTO】
RDB:Redis DataBase,在指定的时间间隔内将内存中的数据集快照写⼊磁盘,实际操作过程是fork⼀个⼦进程,先将数据集写⼊临时文件,写入成功后,再替换之前的⽂件,用⼆进制压缩存储。
优点:
- 整个Redis数据库将只包含⼀个⽂件dump.rdb,方便持久化。
- 容灾性好,方便备份。
- 性能最大化,fork子进程来完成写操作,让主进程继续处理命令,所以是 IO 最大化。使用单独子进程来进行持久化,主进程不会进⾏任何 IO 操作,保证了 redis 的高性能
- 相对于数据集⼤时,比AOF 的启动效率更高。
缺点:
- 数据安全性低。RDB 是间隔⼀段时间进⾏持久化,如果持久化之间 redis 发⽣故障,会发⽣数据丢失。所以这种⽅式更适合数据要求不严谨的时候。
- 由于RDB是通过fork⼦进程来协助完成数据持久化⼯作的,因此,如果当数据集较⼤时,可能会导致整个服务器停⽌服务几百毫秒,甚至是1秒钟。
AOF:Append Only File,以日志的形式记录服务器所处理的每⼀个写、删除操作,查询操作不会记录,以文本的方式记录,可以打开⽂件看到详细的操作记录
优点:
- 数据安全,Redis中提供了3中同步策略,即每秒同步、每修改同步和不同步。事实上,每秒同步也是异步完成的,其效率也是非常高的,所差的是⼀旦系统出现宕机现象,那么这⼀秒钟之内修改的数据将会丢失。而每修改同步,我们可以将其视为同步持久化,即每次发⽣的数据变化都会被立即记录到磁盘中。
- 通过 append 模式写⽂件,即使中途服务器宕机也不会破坏已经存在的内容,可以通过 redis check-aof 工具解决数据⼀致性问题。
- AOF 机制的 rewrite 模式。定期对AOF⽂件进行重写,以达到压缩的目的
缺点:
- AOF 文件比 RDB 文件大,且恢复速度慢。
- 数据集大的时候,比rdb 启动效率低。
- 运行效率没有RDB高, AOF⽂件比RDB更新频率高,优先使用AOF还原数据,AOF比RDB更安全也更大,RDB性能比AOF好,如果两个都配了优先加载AOF。
边栏推荐
- Comment faire une radio personnalisée
- Unity load AB package
- What programming do children learn?
- OAI 5G NR+USRP B210安装搭建
- Common doubts about the introduction of APS by enterprises
- Unity making plug-ins
- [DSP] [Part 1] start DSP learning
- Extraction rules and test objectives of performance test points
- Variable star --- article module (1)
- Application layer of tcp/ip protocol cluster
猜你喜欢
Boder radius has four values, and boder radius exceeds four values
Distributed ID
Value of APS application in food industry
[DIY]自己设计微软MakeCode街机,官方开源软硬件
Activiti global process monitors activitieventlistener to monitor different types of events, which is very convenient without configuring task monitoring in acitivit
使用.Net驱动Jetson Nano的OLED显示屏
Case ① | host security construction: best practice of 3 levels and 11 capabilities
【DSP】【第二篇】了解C6678和创建工程
Gui Gui programming (XIII) - event handling
2022 Guangdong Provincial Safety Officer C certificate third batch (full-time safety production management personnel) simulation examination and Guangdong Provincial Safety Officer C certificate third
随机推荐
Distributed ID
Implementation of packaging video into MP4 format and storing it in TF Card
[DIY]自己设计微软MakeCode街机,官方开源软硬件
Variable star --- article module (1)
Utilisation de l'écran OLED
[weekly pit] information encryption + [answer] positive integer factorization prime factor
Build your own application based on Google's open source tensorflow object detection API video object recognition system (IV)
棋盘左上角到右下角方案数(2)
Tencent byte Alibaba Xiaomi jd.com offer got a soft hand, and the teacher said it was great
Application layer of tcp/ip protocol cluster
Jupyter launch didn't respond after Anaconda was installed & the web page was opened and ran without execution
Ideas and methods of system and application monitoring
为什么新手在编程社区提问经常得不到回答,甚至还会被嘲讽?
华为设备命令
Error analysis ~csdn rebound shell error
02 基础入门-数据包拓展
[cloud lesson] EI lesson 47 Mrs offline data analysis - processing OBS data through Flink
In line elements are transformed into block level elements, and display transformation and implicit transformation
2022 nurse (primary) examination questions and new nurse (primary) examination questions
Zoom with unity mouse wheel: zoom the camera closer or farther