当前位置:网站首页>什么是持久化?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持久化的主流方式。
边栏推荐
- Win10 environment phpstudy2016 startup failure record
- OBS Browser+浏览器的基本使用
- LeetCode 剑指Offer II 091 粉刷房子[动态规划] HERODING的LeetCode之路
- "Grammar sugar" -- my new programming knowledge
- NFT insider 63: the sandbox reached a cooperation with Time magazine, and YGG established Spain's subdao
- Laravel document sorting 6. Response
- Leetcode points to the leetcode road of offering II 091 house painting [dynamic planning] heroding
- Development of trading system (VI) -- HFT high frequency trading
- List rendering in wechat applet
- Cesium graphic annotation circle, square, polygon, ellipse, etc
猜你喜欢

Hello CTP (II) -- Introduction to CTP

cesium 图形标注圆形、正方形、多边形、椭圆等

Nodejs 通过Heidisql连接mysql出现ER_BAD_DB_ERROR: Unknown database 'my_db_books'

Mathematical analysis_ Notes_ Chapter 3: limits

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

Cesium drag 3D model

NFT Insider #63:The Sandbox与时代杂志达成合作,YGG成立西班牙subDAO

Is opencv open source?

Failed to install redis interface

Turn 2D photos into 3D models to see NVIDIA's new AI "magic"!
随机推荐
2.吹响半音阶口琴
A-table mouse over the display hand, the current line can be clicked
Cesium 加载显示热力图
Cesium 拖拽3D模型
Finereport (sail soft) handling the problem that the histogram data label is blocked
@RequestBody解决获取参数为null
kenlm
Changsha's "talent seeking": "making efforts" and "making practical moves" go hand in hand, "rapid development" and "slow life" go hand in hand
Detailed explanation of flex attributes in flex layout
mysql的tinyint字段类型判断的疑惑
学习码 滚动码 固定码 有什么区别重码数,编码容量滚动码的原理
2. play the chromatic harmonica
Laravel document sorting 11. System architecture
讲座记录《多种空间大地测量技术的数据处理方法和应用》
"Renaissance" in the digital age? The bottom digital collection makes people happy and sad
kenlm
L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding
Laravel document sorting 10. Request life cycle
NFT Insider #63:The Sandbox与时代杂志达成合作,YGG成立西班牙subDAO
SEO的5大关键指标:排名+流量+会话+停留时长+跳出率