Easy Tutorial
❮ Strings Strlen Keys Ttl ❯

Redis Data Backup and Recovery

The SAVE command in Redis 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.


Recover Data

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

The above command CONFIG GET dir outputs the Redis installation directory as /usr/local/redis/bin.


Bgsave

A Redis backup file can also be created using the BGSAVE command, which executes in the background.

Example

127.0.0.1:6379> BGSAVE

Background saving started
❮ Strings Strlen Keys Ttl ❯