当前位置:网站首页>redis持久化
redis持久化
2022-07-27 05:01:00 【一梦无痕bzy】
一、持久化概念
持久化的范围很广,从内存到硬盘这叫持久化;数据备份也叫持久化(所以mysql也是可以持久化的)
二、redis持久化分类
1、RDB:拍快照
每个时间点更新一次数据。所占有的体积比较小、恢复速度快;但是数据丢失可能会很大(默认RDB,可以手动开启AOF,一旦开启AOF便不会再去读快照文件只会读日志文件)
2、AOF:日志
趋近于实时更新(这个可配置)。所占有的体积比较大、恢复速度慢;但是数据丢失可能会很小
AOF两种模式:
- 实时更新:写一下更新一下日志。因为redis是单线程如果完全实时效率会很低,每次往内存中写数据还得往硬盘中写,然后才能处理其他请求
- 交给os:操作系统基于pagecache(页缓存)去更新,每隔5s更新和达到内存百分之十更新,这两一起工作。会丢数据但没RDB严重)
因为是日志,所以每次更新操作都会记录,但其实有用的就是最后一个记录,所以体积大、恢复速度慢。但是可以配制重写更新掉无用信息,不过这不是实时的是有触发条件的比如特别大了或者到某个时间点。到了4.x版本以后AOF得到改进,当要重写的时候,它并不会去循环遍历删除无用信息,它是直接去内存中拍快照,把快照直接放到AOF中取代原来记录(原来的直接删掉),然后新的
边栏推荐
- Create datasource using Druid connection pool
- Derivation and explanation of PBR physical illumination calculation formula
- [Niuke discussion area] Chapter 7: building safe and efficient enterprise services
- 精选用户故事|洞态在聚水潭的误报率几乎为0,如何做到?
- 2022 Zhengzhou light industry Freshmen's competition topic - I won't say if I'm killed
- B1023 组个最小数
- Alphabetic order problem
- Installation and template setting of integrated development environment pychar
- B1022 D进制的A+B
- 集合框架的使用
猜你喜欢

JVM上篇:内存与垃圾回收篇十四--垃圾回收器

What should test / development programmers over 35 do? Many objective factors

Another skill is to earn 30000 yuan a month+

JVM上篇:内存与垃圾回收篇三--运行时数据区-概述及线程

B1021 个位数统计

How does the TCP server handle multiple client connections on one port (one-to-one or one to many)

File processing (IO)

JDBC API 详解

JVM上篇:内存与垃圾回收篇十--运行时数据区-直接内存

Database connection pool & Druid usage
随机推荐
探寻通用奥特能平台安全、智能、性能的奥秘!
Basic operation of vim
Detailed explanation of pointer constant and constant pointer
JVM Part 1: memory and garbage collection part 10 - runtime data area - direct memory
听过最自律的一句话: 那些我难以言表 不作声响
B1026 程序运行时间
B1021 个位数统计
素数筛选(埃氏筛法,区间筛法,欧拉筛法)
OFDM 16 lecture 2-ofdm and the DFT
The project connects with Alipay payment, and the intranet penetration realizes the monitoring of asynchronous callback notification of successful payment of Alipay
Card drawing program simulation
笔记系列之docker安装Postgresql 14
During its low-level period, this slave edge causes the instruction number to make a corresponding model
[optical flow] - data format analysis, flowwarp visualization
Introduction to Web Framework
JVM上篇:内存与垃圾回收篇九--运行时数据区-对象的实例化,内存布局与访问定位
34. Analyze flexible.js
DBUtils
JVM Part 1: memory and garbage collection part 9 - runtime data area - object instantiation, memory layout and access location
DBUtils