Redis › Persistence (RDB/AOF)
What is AOF, or append only file, persistence, and how does it differ from RDB snapshots?
BeginnerAnswer
AOF persistence logs every write operation to a file as it happens, rather than periodically saving the entire dataset at once like RDB, meaning it can offer much better durability with less potential data loss since nearly every write is recorded individually, though the resulting log file can grow significantly larger than an equivalent RDB snapshot.
CONFIG SET appendonly yes
CONFIG SET appendfsync everysecReal-world example A financial application enables AOF persistence to minimize the risk of losing recent transactions, accepting the larger file size in exchange for the much stronger durability guarantee it provides over RDB snapshots alone.