Redis Backup
# Redis Data Backup and Recovery
The Redis **SAVE** command is used to create a backup of the current database.
### Syntax
The basic syntax for the Redis Save command is as follows:
redis 127.0.0.1:6379> SAVE
### Example
redis 127.0.0.1:6379> SAVE OK
This command will create a dump.rdb file in the Redis installation directory.
* * *
## Restoring Data
If you need to restore the data, simply move the backup file (dump.rdb) to the Redis installation directory and start the service. You can use the **CONFIG** command to get the Redis directory, as shown below: redis 127.0.0.1:6379> CONFIG GET dir 1) "dir"2) "/usr/local/redis/bin"
The Redis installation directory output by the above command **CONFIG GET dir** is /usr/local/redis/bin.
* * *
## Bgsave
You can also use the command **BGSAVE** to create a Redis backup file, which executes in the background.
### Example
127.0.0.1:6379> BGSAVE Background saving started
YouTip