Database / REDIS
How do you configure Redis persistence for a production deployment?
Production Redis persistence is typically both RDB and AOF enabled together, tuned to balance recovery speed, durability, and operational overhead, rather than relying on just one mechanism alone.
# redis.conf save 900 1 save 300 10 save 60 10000 appendonly yes appendfsync everysec auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb
The reasoning behind this common combination: RDB snapshots provide fast, compact backups useful for disaster recovery and moving data between environments, while AOF with appendfsync everysec caps potential data loss at roughly one second of writes, a durability level most applications find acceptable without the latency cost of always. auto-aof-rewrite-percentage controls when Redis automatically compacts the AOF file (once it's grown a configured percentage larger than after the last rewrite), keeping it from growing unbounded. For genuinely critical data, pairing this local persistence config with replication (so a replica also holds a full copy) is standard, since local persistence alone still leaves a gap between the last fsync and any writes since, whereas a fully synced replica offers an additional, independent copy.
More Related questions...
