Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

BGREWRITEAOF

Last updated
BGREWRITEAOF
Group
Server
Complexity
O(1) to start; the rewrite itself is O(N) in the number of keys
Arity
1 (exactly, counting the command name)
Flags
admin
HotKV Cloud
All plans
On-Premise
no license needed

The append-only file (AOF) grows with every write. BGREWRITEAOF starts rewriting it in the background as the shortest sequence of commands that recreates the current data set, then replaces the old file. Clients keep being served, and writes made during the rewrite are kept.

The server also rewrites the AOF on its own when it has grown by auto-aof-rewrite-percentage since the last rewrite and is larger than auto-aof-rewrite-min-size. Check progress with aof_rewrite_in_progress and the result with aof_last_bgrewrite_status in INFO persistence.

Case Reply (RESP2 and RESP3)
Rewrite started Simple string Background append only file rewriting started
A rewrite is already running Error ERR Background append only file rewriting already in progress
127.0.0.1:6379> BGREWRITEAOF
Background append only file rewriting started

In HotKV Cloud, the CLI tab of the panel does not run BGREWRITEAOF. Send it from your own client connection.

Same replies as Redis 7 and Valkey 8. HotKV’s AOF file format is its own; see persistence.

BGSAVE, WAITAOF, CONFIG SET (appendonly, appendfsync)