Module A-13·18 min read

RDB backup scheduling, AOF log shipping to cold storage, BGSAVE + BGREWRITEAOF interaction, DEBUG RELOAD for in-memory consistency checks, and a documented recovery runbook for the three most common failure scenarios.

JJS
Written by Jatin Jain Saraf · Senior Software Engineer

A-13 — Disaster Recovery, Backup, and Point-in-Time Restore

Who this module is for: Redis is holding data that matters — sessions, job queues, rate limit state, coordination locks. If the server dies, you need to recover. This module covers RDB backup scheduling, AOF log shipping, recovery runbooks for the three most common failure scenarios, and the one practice most teams skip: testing restore procedures before they need them.


The Backup Strategy Pyramid

Not all Redis data needs the same protection:

Data TypeRecovery StrategyRTORPO
Pure cacheRegenerate from DB on missSecondsAny (cache is disposable)
Session storeRestore from RDB + accept some logoutsMinutesLast snapshot
Job queueRestore from RDB + reprocess in-flight jobsMinutesLast snapshot
Rate limit stateRestore from RDB + accept burst on restartMinutesLast snapshot
Event log / audit trailAOF log shipping + S3< 30 min< 1 minute

RPO (Recovery Point Objective): Maximum acceptable data loss (time).
RTO (Recovery Time Objective): Maximum acceptable downtime (time to recover).

Design your persistence configuration to meet the RPO; design your restore procedure to meet the RTO.


RDB Backup Scheduling

Automated Periodic Snapshots

bash

Add to cron:

text

Backup Retention Policy

text

Implement with S3 Lifecycle policies:

json

AOF Log Shipping

For near-real-time backup (RPO < 1 minute), ship the AOF file to durable storage continuously:

bash

For Redis 7.0+ multi-part AOF (RDB base + incremental AOF files):

bash

BGSAVE and BGREWRITEAOF Interaction

If you're shipping both RDB snapshots and AOF files as backup layers, know what happens when they overlap: Redis will not run BGSAVE and BGREWRITEAOF at the same time. If a BGREWRITEAOF is already in progress and a scheduled BGSAVE fires (or vice versa), the second one is deferred — Redis logs a message and starts it automatically once the first finishes, rather than running both fork()s concurrently. This matters for backup scheduling in two ways:

  • Don't assume your RDB backup cron job and your AOF rewrite trigger are independent. If they collide, your backup script needs to poll (INFO persistence — check rdb_bgsave_in_progress/aof_rewrite_in_progress) rather than assuming the snapshot completed on schedule.
  • Both operations fork a child process, and both children hold a copy-on-write reference to the dataset. If they did somehow overlap (they don't, by design, but a naive mental model might assume otherwise), you'd risk doubling the memory overhead from copy-on-write page duplication under write load — one more reason Redis serializes them rather than running both at once.

Sign in to keep reading

The rest of this module is free — sign in with Google to unlock it and track your progress.

Sign in & Register

Discussion

0

Join the discussion

Loading comments...

© 2026 Jatin Jain Saraf (JJS). All rights reserved.