当前位置:网站首页>Redis aof日志持久化
Redis aof日志持久化
2022-07-28 01:41:00 【yu-yuan】
AOF 工作原理
当你使用Redis做一些事情,都会把你做的事情写到一个文本文件上。
配置:

appendonly 这个是aof日志功能 是否打开 yes

我们在使用AOF是如何在写入速度和数据持久化上,起一个平衡方案,这里可以使用
appendfsync always : 每1个命令都立刻同步到AOF 安全,速度慢
no : 写入工作交给操作系统,由于操作系统判断缓冲区大小,统一写入AOF,同步频率低,速度快。
eveysec : 折衷方案,每秒写一次

no-appendfsync-on-rewrite yes: # 正在导出rdb快照的过程中,要不要停止同步aof
auto-aof-rewrite-percentage 100 #aof文件大小比起上次重写时的大小,增长率100%时,重写
auto-aof-rewrite-min-size 64mb #aof文件,至少超过64M时,重写 (bgrewriteaof 重写命令)
面试常问:
注: 在dump rdb过程中,aof如果停止同步,会不会丢失?
答: 不会,所有的操作缓存在内存的队列里, dump完成后,统一操作.
注: aof重写是指什么?
答: aof重写是指把内存中的数据,逆化成命令,写入到.aof日志里 以解决 aof日志过大的问题.
问: 如果rdb文件,和aof文件都存在,优先用谁来恢复数据?
答: rdb rdb恢复数据快
问: 2种是否可以同时用?
答: 可以,而且推荐这么做
问: 恢复时rdb和aof哪个恢复的快
答: rdb快,因为其是数据的内存映射,直接载入到内存,而aof是命令,需要逐条执行
边栏推荐
- 关于Sqli-labs单引号不报错的问题
- Say yes, I will love you, and I will love you well
- 程序里随处可见的interface,真的有用吗?真的用对了吗?
- In practical work, how do I use postman for interface testing?
- 【OpenGL】GLES20.glClear
- [brother hero's July training] day 27: picture
- 【HCIP】路由策略、策略路由
- "The faster the code is written, the slower the program runs"
- Wechat campus bathroom reservation applet graduation design finished product (1) development outline
- POC simulation attack weapon - Introduction to nucleus (I)
猜你喜欢

Say yes, I will love you, and I will love you well

New infrastructure helps the transformation and development of intelligent road transportation
![[software testing] - unittest framework for automated testing](/img/7a/29b222cb0b6a5953b98f8d797cd106.png)
[software testing] - unittest framework for automated testing

"The faster the code is written, the slower the program runs"

【信号去噪】基于卡尔曼滤波实现信号去噪附matlab代码

Use of Day6 functions and modules

Flutter神操作学习之(满级攻略)

"Risking your life to upload" proe/creo product structure design - seam and buckle

新基建助力智能化道路交通领域的转型发展

MySQL 中的 INSERT 是怎么加锁的?(荣耀典藏版)
随机推荐
ps 简单使用
[leetcode] 13. linked list cycle · circular linked list
AWS elastic three swordsman
Lock mechanism in MySQL database InnoDB storage engine (glory Collection Edition)
Maskedauutoencoders visual learner cvpr2022
New infrastructure helps the transformation and development of intelligent road transportation
"The faster the code is written, the slower the program runs"
Common SQL statement query
How is insert locked in MySQL? (glory Collection Edition)
Say yes, I will love you, and I will love you well
What can you say to comfort your girlfriend or daughter-in-law
Compile and use Qwt in qt|vs2017
Share an esp32 relay
Achievements in science and Technology (XXVIII)
MySQL's way to solve deadlock - lock analysis of common SQL statements
QT implementation disable shortcut key
selenium+pytest+allure综合练习
数字孪生农业丨智慧农业稻米加工厂从“看天吃饭”到“知天而作”
Newline required at end of file but not found.
Pytorch optimizer settings