当前位置:网站首页>什么是持久化?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持久化的主流方式。
边栏推荐
- Is opencv open source?
- openmmlab-环境配置
- 【LeetCode】148. 排序链表
- How many images can opencv open?
- "Renaissance" in the digital age? The bottom digital collection makes people happy and sad
- SQL, CTE, flg case problems
- Flutter FittedBox组件
- Numpy NP tips: squeeze and other processing of numpy arrays
- 升级cmake
- Where is the red area of OpenCV?
猜你喜欢

Trading system development (IV) - trading counter system

UCLA | generative pre training for black box optimization

Flutter FittedBox组件

"Grammar sugar" -- my new programming knowledge

OBS Browser+浏览器的基本使用

Failed to install redis interface

"Comment positionner l'industrie" dans la planification industrielle locale / parc

numpy np tips:使用opencv对数组插值放缩到固定形状 cv2.resize(res, dsize=(64, 64), interpolation=cv2.INTER_CUBIC)

马斯克发布人形机器人,AI对马斯克为什么意义重大?

5 key indicators of SEO: ranking + traffic + session + length of stay + bounce rate
随机推荐
numpy np tips:使用opencv对数组插值放缩到固定形状 cv2.resize(res, dsize=(64, 64), interpolation=cv2.INTER_CUBIC)
Is opencv open source?
mysql的tinyint字段类型判断的疑惑
Read lsd-slam: large scale direct monolithic slam
Lecture record: data processing methods and applications of various spatial geodetic techniques
NFT insider 63: the sandbox reached a cooperation with Time magazine, and YGG established Spain's subdao
Laravel document sorting 10. Request life cycle
CMD operation MySQL in Windows
BSC smart contract dividend mainstream currency | including marketing wallet | deflation | reflow | dividend free token | available for direct deployment
MySQL order by
Communication problems in parent and child components of uniapp
PHP code audit 2 - these functions must be known and understood
[proteus simulation] Arduino uno key controls the flashing increase / decrease display of nixie tube
Development of trading system (XII) - Official quickfix document
How many images can opencv open?
Intel 13th generation core showed its true colors for the first time: 68mb cache improved significantly
如何绘制产业招商地图
A-table mouse over the display hand, the current line can be clicked
Cesium loading display thermal diagram
Exercise: how difficult is it to simulate the blessing lottery two-color ball - China 500W grand prize? Just run the code.