Login to Redis
$ redis-cli
Locate Redis database directory
127.0.0.1:6379> config get dir
Output
1) "dir"
2) "/var/lib/redis"
Commit the latest changes to the database
127.0.0.1:6379> save
Exit out of Redis
127.0.0.1:6379> exit
Create backup directory
$ mkdir -p /backup/redis
Copy the Redis database to backup directory
$ cp /var/lib/redis/dump.rdb /backup/redis/dump.rdb
Stop the Redis server
$ systemctl stop redis.service
Rename current Redis database
$ mv /var/lib/redis/dump.rdb /var/lib/redis/dump.rdb.old
Copy the backup Redis database to the Redis directory
$ cp /backup/redis/dump.rdb /var/lib/redis/dump.rdb
Set ownership on Redis database
$ chown redis.redis /var/lib/redis/dump.rdb
Set permissions on Redis database
$ chmod 660 /var/lib/redis/dump.rdb
Start the Redis server
$ systemctl start redis.service