Advertisement
Advanced Redis, Persistence (RDB/AOF)

How would you design a persistence strategy that combines both RDB and AOF to get the benefits of both approaches?

Short answer

You would enable both RDB snapshots for fast, compact full backups useful for quick restores and off site backup storage, and AOF for stronger durability during normal operation, configuring Redis to prefer loading from AOF on restart since it typically has less potential data…

Save Redis mock interview
Advertisement
AModel answer
You would enable both RDB snapshots for fast, compact full backups useful for quick restores and off site backup storage, and AOF for stronger durability during normal operation, configuring Redis to prefer loading from AOF on restart since it typically has less potential data loss, while still keeping RDB snapshots available as an additional safety net and for easier data portability.
Example

CONFIG SET save '900 1' CONFIG SET appendonly yes CONFIG SET appendfsync everysec

Real-world example
A company running a critical Redis instance enables both RDB and AOF together, getting fast periodic snapshots for easy backup and disaster recovery purposes while also benefiting from AOF's stronger protection against data loss during normal operation.
Likely follow-ups
  • Which persistence method does Redis prefer to load from if both are present after a restart?
  • What are the tradeoffs of running both persistence methods simultaneously in terms of disk usage and performance?
Related topics