Redis Bgrewriteaof Command

Redis Server

The Redis Bgrewriteaof command is used to asynchronously execute an AOF (AppendOnly File) rewrite operation. The rewrite creates a size-optimized version of the current AOF file.

Even if Bgrewriteaof fails, no data will be lost, because the old AOF file will not be modified before Bgrewriteaof succeeds.

Note:Since Redis 2.4, AOF rewriting is triggered automatically by Redis. BGREWRITEAOF is only used to manually trigger the rewrite operation.

Syntax

The basic syntax of the redis Bgrewriteaof command is as follows:

redis 127.0.0.1:6379> BGREWRITEAOF 

Available Versions

>= 1.0.0

Return Value

Feedback information.

Example

redis 127.0.0.1:6379>
Background append only file rewriting started

Redis Server

Other extensions