当前位置:网站首页>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"

边栏推荐
- TZC 1283: simple sorting - function method
- Webassembly 01 basic information
- It's enough for newcomers to learn how to do functional tests
- Getaverse,走向Web3的远方桥梁
- 517. 超级洗衣机
- A trick to teach you to easily understand Potter's map
- 高频电子线路复习考试题及答案
- Getting started with ALV
- DOM event flow event bubble event capture event delegate
- FTP实验及概述
猜你喜欢
![[personal summary] end of July 24, 2022](/img/9e/dfc37c2684aa8849291817782c947b.png)
[personal summary] end of July 24, 2022

A trick to teach you to easily understand Potter's map

OD-Paper【2】:Fast R-CNN

学生如何申请免费IDEA

Redis 官方可视化工具,高颜值,功能真心强大!

10. 正则表达式匹配

Benji Bananas 开启第二季边玩边赚奖励活动,支持使用多张 Benji 通行证!

中文文本纠错任务简介

Princeton calculus reader 02 Chapter 1 -- composition of functions, odd and even functions, function images

SAP report development steps
随机推荐
The first positive number missing in question 41 of C language. Two methods, preprocessing, fast sorting and in situ hashing
How students apply for free idea
Bash shortcut key to improve command line efficiency [Full Version]
Efficient, reliable and safe open source solution for serial communication
MongoDB 常用命令
Hack The Box - Introduction to Networking Module详细讲解中文教程
10. Regular expression matching
SQL injection
Lesson 2 getting to know slam for the first time
Three implementation methods of thread and the usage of handler
C language - Advanced pointer
[STM32 series summary] blogger's way to quickly advance STM32 in actual combat (continuous update)
又一开源神器,值得收藏学习!
High frequency electronic circuit review examination questions and answers
517. Super washing machine
Debugging sharp weapon! A lightweight log library log.c
A trick to teach you to easily understand Potter's map
OD-Paper【1】:Rich feature hierarchies for accurate object detection and semantic segmentation
Benji Bananas 开启第二季边玩边赚奖励活动,支持使用多张 Benji 通行证!
Usage and common problems of SIP softphone registered with SIP account