当前位置:网站首页>什么是持久化?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持久化的主流方式。
边栏推荐
- Basic use of OBS browser+ browser
- Hot and cold, sweet and sour, want to achieve success? Dengkang oral, the parent company of lengsuanling, intends to be listed on the main board of Shenzhen Stock Exchange
- SEO的5大关键指标:排名+流量+会话+停留时长+跳出率
- Upgrade cmake
- SQL, CTE, flg case problems
- UCLA | generative pre training for black box optimization
- A-table mouse over the display hand, the current line can be clicked
- Detailed explanation of flex attributes in flex layout
- How to quickly deliver high-value software
- Standing wave ratio calculation method
猜你喜欢
Failed to install redis interface
How much do you know about the use value of WMS warehouse management system
Watch out for the stolen face! So many risks of face recognition used every day?
DAP数据调度功能完善说明
Hello CTP (III) - CTP quotation API
MySQL插入过程报错1062,但是我没有该字段。
Cesium 拖拽3D模型
How to install opencv? Opencv download installation tutorial
代錶多樣性的彩色 NFT 系列上線 The Sandbox 市場平臺
Cesium 加载显示热力图
随机推荐
Synchronous and asynchronous functions (callback function, promise, generator, async/await)
【Kubernetes系列】Helm的安装使用
AI quantitative transaction (I) -- Introduction to quantitative transaction
Standing wave ratio calculation method
SQL, CTE, flg case problems
代錶多樣性的彩色 NFT 系列上線 The Sandbox 市場平臺
Development of trading system (XII) - Official quickfix document
PHP code audit 2 - these functions must be known and understood
【LeetCode】22. bracket-generating
Hello CTP (II) -- Introduction to CTP
Failed to install redis interface
[openwrt] we recommend a domestically developed version of openwrt, an introduction to istoreos. It is very easy to use. It is mainly optimized. It solves the problem of Sinicization.
【LeetCode】143. Rearrange linked list
What is the difference between learning code, rolling code and fixed code? The number of repeated codes, coding capacity and the principle of rolling code
Nodejs 通过Heidisql连接mysql出现ER_BAD_DB_ERROR: Unknown database 'my_db_books'
L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding
Flutter FittedBox组件
Numpy NP tips: squeeze and other processing of numpy arrays
Changsha's "talent seeking": "making efforts" and "making practical moves" go hand in hand, "rapid development" and "slow life" go hand in hand
How to use ide to automatically sign and debug Hongmeng application