当前位置:网站首页>Redis AOF日志
Redis AOF日志
2022-07-01 22:58:00 【Mar丶流年】
为什么日志是后写入
因为日志没有语法检查,先写入日志,则可能写入错误命令。不利于redis使用日志恢复
后写入则是依靠redis执行,来保证命令的正确性
AOF三种落盘机制
写后落盘
redis执行完一条命令,写一次日志到磁盘中
写的操作阻塞线程,影响后续redis执行命令
效率:低
宕机 有可能丢失一条记录
一秒一写
redis执行完一条命令后,将命令写入AOF内存缓冲区
每隔一秒将缓冲区内容写入磁盘(异步)
效率:中
宕机 有可能丢失一秒内的日志
操作系统控制写回
redis执行完一条命令后,将命令写入AOF内存缓冲区
由操作系统控制何时写到磁盘中去(异步)
效率:高
宕机 有可能丢失大量日志
AOF重写
AOF重写的作用就是忽略过程,注重结果(反正我没事务)
假设我有个记录A,被100个命令修改了一百次,最后的结果是100
此时AOF记录就有100条,但是重写后就只有一条
即 A = 100
AOF重写减小日志大小
大文件是文件操作系统所不允许的
大文件的日志会影响写入速度
大文件的日志会影响redis的恢复速度
AOF重写机制
主线程fork出bgrewriteaof子进程
bgrewriteaof中拷贝redis内存数据
bgrewriteaof中的线程将reids内存数据 + AOF重写缓冲区数据 组成新的AOF 来替换旧的AOF
在AOF重写过程中,旧的AOF依旧在正常写入,来应对重写未完成时的宕机问题
AOF重写是会影响主线程的
1.在子进程拷贝数据时会阻塞主线程
2.在主线程操作已有数据时,也会阻塞
父子进程拷贝数据使用的是写时复制
子进程中只拷贝必要的数据结构
子进程和父进程指向相同的内存空间
当父进程进行写的操作时,才会分配新的内存地址,将数据拷贝进去
边栏推荐
- What is the relationship between modeling and later film and television?
- Create Ca and issue certificate through go language
- 微服务服务稳定性治理
- Programming English vocabulary notebook
- Daily three questions 6.29
- Compare the version number [double pointer to intercept the string you want]
- Paramètres communs de matplotlib
- plain framework的实际应用和扩展
- mysql binlog的清理
- dat.GUI
猜你喜欢
Matplotlib常用图表
Current situation and future development trend of Internet of things
【微服务|Sentinel】sentinel整合openfeign
Linux基础 —— CentOS7 离线安装 MySQL
问题随记 —— file /usr/share/mysql/charsets/README from install of MySQL-server-5.1.73-1.glibc23.x86_64 c
CADD course learning (3) -- target drug interaction
AirServer最新Win64位个人版投屏软件
Future trend and development of neural network Internet of things
Win 10 mstsc connect RemoteApp
从第三次技术革命看企业应用三大开发趋势
随机推荐
Jielizhi, production line assembly link [chapter]
上海炒股开户选择手机办理安全吗?
De PIP. Interne. CLI. Main Import main modulenotfounderror: No module named 'PIP'
The difference between timer and scheduledthreadpoolexecutor
物联网现状及未来发展趋势
认识线程
软件架构的本质
JS - use of arguments
Experience of practical learning of Silicon Valley products
2022 crane driver (limited to bridge crane) examination questions and simulation examination
Microservice stability management
RPA: Bank digitalization, business process automation "a small step", and loan review efficiency "a big step"
[micro service sentinel] sentinel integrates openfeign
硅谷产品实战学习感触
2022年危险化学品经营单位安全管理人员考试题及在线模拟考试
Openresty load balancing
Current situation and future development trend of Internet of things
MySQL binlog cleanup
SWT/ANR问题--SWT 导致 low memory killer(LMK)
Airserver latest win64 bit personal screen projection software