当前位置:网站首页>Redis持久化-RDB
Redis持久化-RDB
2022-07-26 05:34:00 【生命不止、战斗不息】
Redis是内存数据库,如果不将内存中的数据库状态保存到磁盘,那么一旦服务器进程退出,服务器中的数据库状态也会消失,所以Redis提供了持久化功能
RDB(Redis DataBase)
什么是RDB
在指定的时间间隔内将内存中的数据集快照写入磁盘,也就是行话讲的Snapshot快照,它恢复时是将快 照文件直接读到内存里。
Redis会单独创建(fork)一个子进程来进行持久化,会先将数据写入到一个临时文件中,待持久化过程 都结束了,再用这个临时文件替换上次持久化好的文件。整个过程中,主进程是不进行任何IO操作的。这就确保了极高的性能。如果需要进行大规模数据的恢复,且对于数据恢复的完整性不是非常敏感,那RDB方式要比AOF方式更加的高效。RDB的缺点是最后一次持久化后的数据可能丢失。
Fork
Fork的作用是复制一个与当前进程一样的进程。新进程的所有数据(变量,环境变量,程序计数器等) 数值都和原进程一致,但是是一个全新的进程,并作为原进程的子进程。
rdb保存的文件是 dump.rdb

配置位置及SNAPSHOTTING解析

这里的触发条件机制,我们可以修改测试一下:
save 120 10 # 120秒内修改10次则触发RDB
- save 时只管保存,其他不管,全部阻塞
- bgsave,Redis 会在后台异步进行快照操作,快照同时还可以响应客户端请求。可以通过lastsave命令获取最后一次成功执行快照的时间。
127.0.0.1:6379> config get dir
1) "dir"
2) "/www/server/redis"

边栏推荐
- How to handle aggregate collection code
- Debugging sharp weapon! A lightweight log library log.c
- How are masters refined?
- Hack The Box -SQL Injection Fundamentals Module详细讲解中文教程
- C language explanation series -- understanding of functions (3) formal parameters, arguments, nested calls and chain access
- Flex layout principle and common parent elements
- Hack the box - Introduction to networking module detailed Chinese tutorial
- FTP experiment and overview
- Mongodb tutorial Chapter 08 comparison operators
- How to understand "array name is essentially an address" from the perspective of memory parsing?
猜你喜欢
C语言详解系列——函数的认识(3)形参,实参,嵌套调用和链式访问

Application and value of IVR in VoIP telephone system

OD-Paper【1】:Rich feature hierarchies for accurate object detection and semantic segmentation

Shell read read console input, use of read

High frequency electronic circuit review examination questions and answers

10. Regular expression matching

ES Cluster in Red status: what about write & delete operations?

Efficient, reliable and safe open source solution for serial communication

Embedded development notes, practical knowledge sharing

电机控制专栏文章汇总
随机推荐
高手是怎样炼成的?
QT writing IOT management platform 47 general database settings
Day011 一维数组
mysql如果计算本月变动/本月增幅/同比变动/同比增幅?
TZC 1283: simple sort Bubble Sort
Development to testing: a six-year road to automation from scratch
三本毕业,三年嵌入式软件的心路历程
SAP report development steps
How are masters refined?
Real scientific weight loss
虚拟偶像代言产品出问题谁负责? 且听律师分析
Flex layout principle and common parent elements
Shell read read console input, use of read
家居vr全景展示制作提高客户转化
高分子物理试题库
If MySQL calculates the current month change / current month increase / year-on-year change / year-on-year increase?
Hack the box - Web requests module detailed Chinese tutorial
SIP账号注册的SIP软电话的使用和常见问题
Yolov3 preparatory work
攻防世界-FlatScience