English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Data Backup and Recovery

Redis SAVE This command is used to create a backup of the current database.

Syntax

The basic syntax of the Redis Save command is as follows:

redis 127.0.0.1:6379> SAVE

Online Examples

redis 127.0.0.1:6379> SAVE 
OK

This command will create a dump.rdb file in the Redis installation directory.

Restore Data

If you need to restore data, simply move the backup file (dump.rdb) to the Redis installation directory and start the service. To get the Redis directory, you can use CONFIG Command, as shown below:

 redis 127.0.0.1:6379> CONFIG GET dir
1) "dir"
2) "/usr/local/redis/bin"

The above commands CONFIG GET dir The output directory for the Redis installation is /usr/local/redis/bin.

Bgsave

You can also use the command to create a Redis backup file. BGSAVE, this command is executed in the background.

Online Examples

127.0.0.1:6379> BGSAVE
Background saving started