首页/数据/数据库速查/AOF 开启与文件布局(7.0 多文件结构)
本包目录(495 条)
MySQL 基础与连接36 条SQL 语法52 条用户与权限21 条备份与恢复56 条主从复制与高可用53 条性能与调优57 条Redis 命令96 条
Redis 运维与场景124 条

AOF 开启与文件布局(7.0 多文件结构)

AOF 记录每条写命令:appendonly yes 开启;7.0 起 AOF 由 appendonlydir 下的 manifest + base + incr 文件组成,不再是单个 appendonly.aof。

数据库速查数据更新于 2026-10-12
appendonlyyes/no 开关;动态可改但会触发重写
appendfilename文件名前缀,默认 appendonly.aof
appenddirname7.0+ 目录名,默认 appendonlydir

开启与查看

开启与查看
CONFIG SET appendonly yes
INFO persistence | grep aof
# 文件布局(7.0+):
# appendonlydir/appendonly.aof.manifest
# appendonlydir/appendonly.aof.1.base.rdb
# appendonlydir/appendonly.aof.1.incr.aof
CONFIG GET appenddirname
BGREWRITEAOF
动态开启 AOF 会 fork 重写一次(已有数据转为 base);大实例上安排在低峰,并用 INFO 跟踪 aof_rewrite_in_progress。

易错点

  • 按老流程备份 appendonly.aof 单文件:7.0 后文件在 appendonlydir 里,备份脚本要覆盖整个目录与 manifest
  • 以为开了 AOF 就每条命令都落盘:刷盘频率由 appendfsync 决定

数据来源与参考

  • Redis 官方文档: AOF
  • Redis 7.0 多部分 AOF

相关工具

​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌