Redis Bgrewriteaof Command
The Redis Bgrewriteaof command is used to asynchronously execute an AOF (AppendOnly File) file rewrite operation. The rewrite creates a size-optimized version of the current AOF file.
Even if Bgrewriteaof fails, no data is lost, because the old AOF file is not modified until Bgrewriteaof succeeds.
**Note:** Starting from Redis 2.4, AOF rewrite is triggered by Redis itself; 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 Version
= 1.0.0
Return Value
Feedback information.
Example
redis 127.0.0.1:6379>
Background append only file rewriting started