Asynchronously rewrites the append-only file to disk.
BGREWRITEAOF
Instruct Valkey to start an Append Only File rewrite process. The rewrite will create a small optimized version of the current Append Only File.
If BGREWRITEAOF fails, no data gets lost as the old AOF
will be untouched.
The rewrite will be only triggered by Valkey if there is not already a background process doing persistence.
Specifically:
BGREWRITEAOF will
still return a positive status reply, but with an appropriate message.
You can check if an AOF rewrite is scheduled looking at the INFO command.The AOF rewrite is automatically triggered by Valkey, however the
BGREWRITEAOF command can be used to trigger a rewrite at
any time.
Please refer to the persistence documentation for detailed information.
Simple string indicating that the rewriting started or is about to start ASAP when the call is executed with success.
The command may reply with an error in certain cases, as documented above.
O(1)
@admin @dangerous @slow
ACL, ACL CAT, ACL DELROLE, ACL DELUSER, ACL DIGEST, ACL DRYRUN, ACL GENPASS, ACL GETROLE, ACL GETUSER, ACL HELP, ACL LIST, ACL LOAD, ACL LOG, ACL ROLES, ACL SAVE, ACL SETROLE, ACL SETUSER, ACL USERS, ACL WHOAMI, BGSAVE, COMMAND, COMMAND COUNT, COMMAND DOCS, COMMAND GETKEYS, COMMAND GETKEYSANDFLAGS, COMMAND HELP, COMMAND INFO, COMMAND LIST, COMMANDLOG, COMMANDLOG GET, COMMANDLOG HELP, COMMANDLOG LEN, COMMANDLOG RESET, CONFIG, CONFIG GET, CONFIG HELP, CONFIG RESETSTAT, CONFIG REWRITE, CONFIG SET, DBSIZE, DEBUG, FAILOVER, FLUSHALL, FLUSHDB, HOTKEYS, HOTKEYS GET, HOTKEYS HELP, HOTKEYS RESET, INFO, LASTSAVE, LATENCY, LATENCY DOCTOR, LATENCY GRAPH, LATENCY HELP, LATENCY HISTOGRAM, LATENCY HISTORY, LATENCY LATEST, LATENCY RESET, LOLWUT, MEMORY, MEMORY DOCTOR, MEMORY HELP, MEMORY MALLOC-STATS, MEMORY PURGE, MEMORY STATS, MEMORY USAGE, MODULE, MODULE HELP, MODULE LIST, MODULE LOAD, MODULE LOADEX, MODULE UNLOAD, MONITOR, PSYNC, REPLCONF, REPLICAOF, RESTORE-ASKING, ROLE, SAVE, SHUTDOWN, SLOWLOG, SLOWLOG GET, SLOWLOG HELP, SLOWLOG LEN, SLOWLOG RESET, SWAPDB, SYNC, TIME.