Redis save Explained: Configuring RDB Snapshots for Data Persistence
Introduction
The save directive controls Redis Database (RDB) snapshot persistence.
Instead of recording every write operation like AOF, RDB periodically saves the entire dataset to a snapshot file.
This approach provides fast recovery, compact backup files, and lower write overhead, making it a popular choice for backups and disaster recovery.
This guide explains how the save directive works, how to configure snapshot intervals, and best practices for production deployments.
Default Value
A typical Redis installation includes the following snapshot rules:
These rules mean:
If any one of these conditions is met, Redis creates an RDB snapshot.
Syntax
save
Example:
save 600 50
This tells Redis to create a snapshot if:
600 seconds have passed
At least 50 keys have changed
How RDB Snapshots Work
Redis continuously tracks write operations.
When a configured rule is satisfied:
Redis creates a background process.
The process writes the current dataset to an RDB file.
Applications continue running while the snapshot is generated.
Because snapshot creation occurs in the background, client requests experience minimal interruption.
Snapshot File
The snapshot file is usually named:
dump.rdb
Its location depends on the dir configuration.
Example:
/var/lib/redis/dump.rdb
Configure Snapshot Rules
Open the Redis configuration file.
sudo nano /etc/redis.conf
Example configuration:
save 900 1
save 300 100
save 60 5000
Restart Redis.
sudo systemctl restart redis
Disable RDB Snapshots
If you only want to use AOF persistence, disable snapshotting.
save ""
This removes all snapshot rules.
Trigger a Manual Snapshot
You can create an RDB snapshot manually.
redis-cli BGSAVE
Redis creates the snapshot in the background without blocking clients.
Alternatively:
redis-cli SAVE
However, SAVE blocks all client requests until the snapshot is complete and is generally not recommended for production systems.
Verify Snapshot Status
Run:
redis-cli INFO persistence
Example output:
rdb_last_save_time:1750000000
rdb_changes_since_last_save:25
rdb_bgsave_in_progress:0
This information helps monitor snapshot activity.
RDB vs AOF
When Should You Use RDB?
RDB is well suited for:
Regular backups
Disaster recovery
Fast server startup
Read-heavy applications
Cache servers
Many production environments use RDB together with AOF for both performance and durability.
Common Mistakes
Setting Snapshot Intervals Too Frequently
Very frequent snapshots can increase disk I/O and CPU usage.
Setting Intervals Too Long
Long intervals increase the amount of data that may be lost after an unexpected shutdown.
Assuming RDB Eliminates Data Loss
RDB only saves data at scheduled intervals.
Any changes made after the last snapshot may be lost if the server crashes.
Best Practices
Use the default snapshot rules unless your workload requires different settings.
Combine RDB with AOF for better durability.
Store snapshot files on reliable storage.
Back up dump.rdb regularly.
Monitor snapshot duration and disk usage.
Test recovery procedures periodically.
Related Articles
Redis maxmemory-policy Explained
Conclusion
The save directive controls Redis RDB snapshot persistence by defining when the dataset should be written to disk. RDB provides efficient backups, compact snapshot files, and fast recovery, making it an excellent choice for many Redis deployments.
For production environments where both performance and durability are important, using RDB together with AOF is widely considered the best practice. This combination provides faster recovery while minimizing the risk of data loss.
Explore More
› Redis Persistence Explained: RDB vs AOF and Data Durability
› Redis Explained: In-Memory Data Store, Persistence, and Best Practices
› Redis appendonly Explained: Understanding AOF Persistence
› Redis bind Explained: Configuring Network Interfaces Securely
› Why Do People in Southeast Asia Love Iced Drinks? The Climate, Culture, and Science Explained
› Northern vs Southern Chinese Business Culture: Key Differences Explained