RDB and AOF Backup and Restore
Protect your Redis data with point-in-time RDB snapshots and append-only file (AOF) persistence for disaster recovery.
Prerequisites
- -Redis installed and running
- -Write access to Redis data directory
Steps
Trigger an RDB snapshot
Force Redis to create a point-in-time dump file immediately.
BGSAVE forks a child process so the server stays responsive. Use LASTSAVE to check when it completed.
Check last save timestamp
Verify when the most recent RDB snapshot was completed.
Locate the dump file
Find the path to the RDB dump file on disk.
Enable AOF persistence
Turn on append-only file logging for near-realtime durability.
Enabling AOF on a running server triggers a rewrite. Ensure you have sufficient disk space.
Copy backup files to safe storage
Copy the RDB and AOF files to an external backup location.
Restore from an RDB backup
Stop Redis, replace the dump file, and restart to restore data.
Restoring replaces ALL current data. Make a backup of the current dump before restoring.
Full Script
FAQ
Discussion
Loading comments...