0
0
Redisquery~5 mins

Combined RDB + AOF in Redis

Choose your learning style9 modes available
Introduction
Using both RDB and AOF together helps keep your data safe and recover it quickly if Redis stops unexpectedly.
You want fast recovery after a crash but also want to save data regularly.
You need a backup that is compact and easy to load.
You want to minimize data loss by saving changes often.
You want to combine quick startup with durability.
You want to protect your data from power failures and software crashes.
Syntax
Redis
appendonly yes
appendfilename "appendonly.aof"
rdbcompression yes
save 900 1
save 300 10
save 60 10000
appendonly yes enables AOF persistence.
save lines configure RDB snapshots at intervals.
Examples
This config enables both AOF and RDB. RDB snapshots save every 900 seconds if at least 1 key changed, every 300 seconds if 10 keys changed, and every 60 seconds if 10000 keys changed.
Redis
appendonly yes
appendfilename "appendonly.aof"
rdbcompression yes
save 900 1
save 300 10
save 60 10000
This disables AOF and uses only RDB snapshots.
Redis
appendonly no
save 900 1
save 300 10
This enables AOF with syncing every second and disables RDB snapshots.
Redis
appendonly yes
appendfsync everysec
save ""
Sample Program
This configuration file enables both RDB and AOF persistence in Redis. It saves snapshots periodically and logs every write operation to the AOF file.
Redis
# redis.conf example
appendonly yes
appendfilename "appendonly.aof"
rdbcompression yes
save 900 1
save 300 10
save 60 10000
OutputSuccess
Important Notes
Using both RDB and AOF together gives you fast recovery and minimal data loss.
RDB snapshots are compact but happen less often.
AOF logs every change but can be larger and slower to load.
Redis loads AOF first by replaying commands to restore the latest state, falling back to RDB if AOF is corrupted.
Summary
Combined RDB + AOF persistence protects your data well.
RDB provides fast startup with periodic snapshots.
AOF provides durability by logging every write operation.