当前位置:网站首页>什么是持久化?redis 持久化中的RDB和AOF是什么?
什么是持久化?redis 持久化中的RDB和AOF是什么?
2022-06-25 03:58:00 【生活甜甜好运连连】
什么是持久化
持久化(Persistence),即把数据(如内存中的对象)保存到可永久保存的存储设备中(如磁盘)。持久化的主要应用是将内存中的对象存储在数据库中,或者存储在磁盘文件中、XML数据文件中等等。
持久化是将程序数据在持久状态和瞬时状态间转换的机制。
JDBC就是一种持久化机制。文件IO也是一种持久化机制。
我们这样理解:
在一定周期内保持不变就是持久化,持久化是针对时间来说的。
数据库中的数据就是持久化了的数据,只要你不去删除或修改。
比如在IE浏览器中一次Session会话中Session对象变量也是不变的,是Session容器中持久化。
对象持久化的方式有很多种,根据周期不同有,page,Session,Application。
对象序列化机制需要将对象的状态保存到文件中,而后能够通过读入对象状态来重新构造对象,恢复程序状态,
对象序列化的过程是对象持久化的方法之一,把对象保存到文件中。
RDB是什么
RDB持久化是把当前进程数据生成快照保存到硬盘的过程,触发RDB持久化过程分为手动触发和自动触发。
1. 触发机制
手动触发分别对应save和bgsave命令:DB saved on disk
bgsave命令:Background saving started by pid 3152
DB saved on disk
RDB: 0MB of memory userd by copy-on-write
Background saving terminated with success
AOF是什么
AOF(append only file)持久化:以独立日志的方式记录每次写命令,重启时再重新执行AOF文件中命令达到恢复数据的目的。AOF的主要作用是解决了数据持久化的实时性,目前已经是Redis持久化的主流方式。
边栏推荐
- How many images can opencv open?
- SQL, CTE, flg case problems
- Win10 environment phpstudy2016 startup failure record
- Coinlist queuing tutorial to improve the winning rate
- Where is the red area of OpenCV?
- 无法安装redis接口
- How to install opencv? Opencv download installation tutorial
- [kubernetes series] installation and use of Helm
- 【LeetCode】22. 括号生成
- DAP数据调度功能完善说明
猜你喜欢

Simple integration of client go gin -update

Cesium 拖拽3D模型

WMS仓储管理系统的使用价值,你知道多少

警惕超范围采集隐私-移动APP违规十宗罪

AI quantitative transaction (II) -- tushare financial data framework

智慧风电:数字孪生 3D 风机智能设备运维

讲座记录《捷联惯导解算的历史及发展》

How to quickly deliver high-value software

acmStreamOpen返回值问题

5 key indicators of SEO: ranking + traffic + session + length of stay + bounce rate
随机推荐
"Grammar sugar" -- my new programming knowledge
Development of trading system (VIII) -- Construction of low delay network
acmStreamOpen返回值问题
Sourcetree pulls the code and prompts to fill in authentic, but the configuration cannot change the user
Development of trading system (I) -- Introduction to trading system
AI quantitative transaction (I) -- Introduction to quantitative transaction
Changsha's "talent seeking": "making efforts" and "making practical moves" go hand in hand, "rapid development" and "slow life" go hand in hand
如何绘制产业招商地图
Lecture record: new application of inertial navigation - inertial measurement
Hello CTP (V) -- CTP position calculation
UCLA | generative pre training for black box optimization
学习码 滚动码 固定码 有什么区别重码数,编码容量滚动码的原理
Is opencv open source?
IntStream API介绍
1. first knowledge of chromatic harmonica
L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding
MySQL order by
Detailed explanation of flex attributes in flex layout
Flutter Builder & FutureBuilder组件
A-table mouse over the display hand, the current line can be clicked