w3resource logo
Redis Tutorial

Redis Backup and Restore


Redis SAVE command is used to create backup of current redis database. The SAVE commands performs a synchronous save of the dataset producing a point in time snapshot of all the data inside the Redis instance, in the form of an RDB file.



Available since


Return value

Simple string reply: The commands returns OK on success.

Example: Redis Backup

The example given below creates the backup of the current database.> SAVE

This command will create the dump.rdb file in your redis directory.



To restore redis data just move redis backup file (dump.rdb) into your redis directory and start the server. To get your redis directory use CONFIG command can be used. The CONFIG GET command is used to read the configuration parameters of a running Redis server.> CONFIG get dir
1) "dir"
2) "/var/lib/redis/6379"

In the output of above command "/var/lib/redis/6379" is the directory, where redis server is installed.


The alternate command to create a Redis backup is BGSAVE. This command is used to save the DB in the background. 

Example:> BGSAVE

Background saving started