Redis启用AOF时,清单文件内容的含义是什么?

huangapple go评论41阅读模式
英文:

What is the meaning of the content of the manifest file in Redis when AOF is enabled?

问题

The content of the appendonly.aof.manifest file specifies information about two other files, appendonly.aof.1.base.rdb and appendonly.aof.1.incr.aof. Here's the translation of the content:

file appendonly.aof.1.base.rdb seq 1 type b
file appendonly.aof.1.incr.aof seq 1 type i

这个文件内容指定了另外两个文件 appendonly.aof.1.base.rdbappendonly.aof.1.incr.aof 的信息。

英文:

I enabled AOF persistence, and I see 3 files in the AOF directory:

appendonly.aof.1.base.rdb
appendonly.aof.1.incr.aof
appendonly.aof.manifest

I understand the meaning of these 3 files. I want to understand the meaning of content of manifest file: appendonly.aof.manifest

Which is:

#cat appendonly.aof.manifest
file appendonly.aof.1.base.rdb seq 1 type b
file appendonly.aof.1.incr.aof seq 1 type i

What is the meaning of the content of this file?

答案1

得分: 1

多部分AOF文件格式(自Redis 7.0以来)由基本AOF或RDB文件以及包含自基本文件创建以来的新命令的多个增量AOF文件组成。而清单文件用于跟踪这些文件。

清单文件中的每一行描述一个基本文件或增量文件。以下是每行的格式:

file 文件名 seq 序列号 type 文件类型


有3种类型的文件:基本文件,即`b`,增量文件,即`i`,和历史文件,即`h`。当Redis重写AOF文件时,它会创建一个新的基本文件,并将旧文件,包括基本文件和增量文件,标记为历史文件,并稍后将它们删除。

序列号用于记录文件的顺序,以便在重写AOF文件时,不同增量文件中的命令正确排序。
英文:

Multi-part AOF file format (Since Redis 7.0) consists with a base AOF or RDB file and multiple incr AOF files which includes the new commands since the base file is created. And the manifest file is used to track these files.

Each line in a manifest file describes a base or incr file. The following is the format of each line:

file filename seq sequence-number type file-type

There're 3 types of files: base file, i.e. b, incr file, i.e. i, and history file, i.e. h. When Redis rewrites AOF file, it creates a new base file, and mark old files, both base and incr files, as history files, and will delete them latter.

Sequence number is used to record the order of files, so that when rewriting AOF file, commands in different incr files are ordered correctly.

huangapple
  • 本文由 发表于 2023年4月17日 21:03:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/76035455.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定