Appearance
Restore a Redis backup
Restore a Redis cache database backup using the following steps.
To restore a Redis database backup, perform the following steps.
Step 1 - Create a Redis database
Create a Redis backup using SimpleBackups.
Step 2 - Copy your backup URL
- Go to your backup page, then select the "Logs" tab. Afterwards, click the little "( i )" on the right next to the copy you want to download.

- Under the backup restore section on the modal that just popped up, click on "Click to generate a signed download link" then copy the resulting link
Step 3 - Download & uncompress your backup
On your server, run the following command, and use the signed download link you obtained in the previous step (ensure you enclose it in double quotes as shown):
plain
wget "PasteTheSignedDownloadLinkHereBetweenTheQuotes" -O - | gunzip -dc > "redis-backup.rdb"Step 4 - Check AOF settings
Check if AOF setting is enabled in Redis before you restore your backup:
plain
redis-cli CONFIG GET appendonlySample output of the command:
If AOF is not enabled (you see "no" in the command output), you can directly go to Step 5.
Otherwise, you need to disable AOF first:
plain
redis-cli CONFIG SET appendonly noThen:
Step 5 - Find where Redis data are stored
5a) Find the current Redis data directory on your system where it stores its database:
Sample output of the command:
plain
1) "dir"
2) "/var/lib/redis"In our case, the directory is /var/lib/redis - note this directory since we will move our restored backup there later.
5b) Find the current Redis database filename:
plain
redis-cli CONFIG GET dbfilenameSample output of the command:
plain
1) "dbfilename"
2) "dump.rdb"In our case, and usually, the database filename is dump.rdb as shown above - note this filename since we will ensure our restored backup is named like that later.
5c) Shut down Redis (stop the Redis server)
5d) Back up your current Redis database if needed (optional):
plain
cp -rf /var/lib/redis/*.rdb ~/any-redis-backup-directory/5e) Delete all .aof and .rdb files in the Redis data directory from (Step 5a)
plain
rm /var/lib/redis/*.aof /var/lib/redis/*.rdbStep 6 - Restore your backup
Now we will copy the RDB backup file obtained in (Step 3), and restore it into the Redis data directory from (Step 5a) and rename it to the same dbfilename from (Step 5b).
Example based on the values we used in this guide:
plain
sudo cp redis-backup.rdb /var/lib/redis/dump.rdb
sudo chown redis:redis /var/lib/redis/dump.rdb
sudo chmod 660 /var/lib/redis/dump.rdbplain
redis-cli CONFIG SET appendonly yes
redis-cli CONFIG REWRITEIf you need any help in any of these steps, let us know and we can help you with the restore.