7 questionsYou use the SAVE command to synchronously create an RDB snapshot file, or the BGSAVE command to create the same snapshot in the background without blocking other operations, and then copy that resulting RDB file to a safe backup location such as another server or cloud storage.
Example
BGSAVE
-- Wait for it to complete, then copy the resulting file
cp /var/lib/redis/dump.rdb /backups/redis_backup_20260907.rdb
Real-world example
A team schedules a nightly BGSAVE followed by copying the resulting RDB file to an off site cloud storage location, ensuring they always have a recent, safely stored backup available if disaster strikes.
Likely follow-ups
- How do you verify that a backup RDB file is not corrupted?
- Where should backup files ideally be stored for maximum safety?
Persistence (RDB/AOF) Redis Architecture & Installation
You stop the Redis server, replace its current data file with the backup RDB file you want to restore, ensuring it is placed in the directory and with the filename Redis expects based on its configuration, and then start the Redis server again, which will automatically load the data from that restored file.
Example
systemctl stop redis
cp /backups/redis_backup_20260907.rdb /var/lib/redis/dump.rdb
systemctl start redis
Real-world example
A company recovers their Redis instance after a hardware failure by stopping the service, replacing the data file with their most recent backup, and restarting Redis, quickly restoring their application's cached data.
Likely follow-ups
- What happens if the restored RDB file is from a significantly older backup than expected?
- Do you need to restore both RDB and AOF files, or just one?
Persistence (RDB/AOF) Redis Architecture & Installation
A reasonable approach often includes taking frequent RDB snapshots, such as every few hours, retaining daily backups for a few weeks and weekly backups for several months, storing backups in a separate location from the production server itself, and regularly testing that these backups can actually be restored successfully rather than just assuming they work.
Example
-- Example retention approach
-- Hourly snapshots kept for 24 hours
-- Daily snapshots kept for 30 days
-- Weekly snapshots kept for 6 months
Real-world example
A company establishes a tiered backup retention policy for their critical Redis instance, keeping recent snapshots for quick recovery from minor issues while retaining older weekly backups for protection against problems discovered much later.
Likely follow-ups
- How do you decide the right retention period for your specific application?
- What storage cost considerations come with a longer retention policy?
Redis Backup & Disaster Recovery Persistence (RDB/AOF)
You would maintain replicas or a full standby Redis Cluster in a geographically separate location, regularly synchronize or ship backups to that separate location, document and periodically test a clear failover procedure for redirecting your application to the standby location, and ensure your team knows exactly what steps to take during an actual disaster scenario.
Example
-- Replicate to a standby instance in a different region
REPLICAOF primary_server_in_other_region 6379
Real-world example
A global e-commerce company maintains a fully synchronized Redis replica in a separate geographic region, with a documented and regularly tested failover procedure ready to redirect traffic there if their primary data center ever becomes completely unavailable.
Likely follow-ups
- How often should a disaster recovery failover procedure actually be tested?
- What is an acceptable amount of data loss during this kind of regional failover?
Redis Replication Redis Sentinel & High Availability
You would simulate a realistic failure scenario, such as intentionally taking down your primary Redis instance in a controlled test environment, have your team follow their documented recovery procedure exactly as they would during a real incident, measure how long the actual recovery takes, and use what you learn to improve both your documentation and your actual recovery process for next time.
Example
-- Simulated drill steps
-- 1. Intentionally stop the primary instance
-- 2. Follow documented failover procedure
-- 3. Measure actual recovery time
-- 4. Document lessons learned
Real-world example
A financial services company runs a quarterly disaster recovery drill for their Redis infrastructure, discovering during one drill that their documented recovery steps were outdated, allowing them to fix the documentation before a real emergency ever occurred.
Likely follow-ups
- How often should disaster recovery drills realistically be conducted?
- What metrics should be tracked during a drill to measure its success?
Redis Sentinel & High Availability Redis Monitoring & Observability
You should use BGSAVE rather than SAVE to avoid blocking the main Redis process during the snapshot, be aware that BGSAVE forks a child process which briefly needs additional memory roughly equal to the size of changes since the last save, schedule backups during lower traffic periods when possible, and monitor memory usage closely during backups to avoid triggering unexpected eviction or out of memory conditions.
Example
-- Monitor memory during backup operations
INFO memory
BGSAVE
Real-world example
A team backing up a very large Redis dataset schedules their BGSAVE operations during their lowest traffic period each day, carefully monitoring memory usage to ensure the temporary overhead from the backup process does not cause unexpected issues.
Likely follow-ups
- How much additional memory overhead does BGSAVE typically require?
- What happens if the server runs out of memory during a background save operation?
Redis Memory Optimization Persistence (RDB/AOF)
Managed cloud Redis services often provide automated backup scheduling, point in time recovery options, cross region replication, and automated failover as built-in features you can configure through their management interface, significantly reducing the manual operational work required compared to setting up and maintaining all of this yourself on a self hosted instance.
Example
-- Managed services typically expose backup settings
-- through their console or configuration API
-- rather than requiring manual scripts
Real-world example
A startup chooses a managed Redis cloud service specifically to avoid the operational burden of building and maintaining their own backup and disaster recovery infrastructure, relying instead on the provider's built-in automated capabilities.
Likely follow-ups
- What are the tradeoffs of relying on a managed service's built-in backup features versus building your own custom solution?
- How do you verify a managed service's backup and recovery capabilities actually meet your specific requirements?
Redis Sentinel & High Availability Redis with Docker & Kubernetes