Redis Backup & Restore

SAVE command is used to create a backup of a current Redis database. This command will create a dump.rdb file in your Redis directory by performing synchronous save.

Syntax

Return Value

The SAVE command returns OK after successful execution.


Redis Backup Example

Use the SAVE command to create a backup of the current database.

SAVE

Redis Backup 1

It will create a dump.rdb file in your Redis directory.

You can see that the dump.rdb file is created.

Redis Backup 2

Restore Redis Data

You have to move Redis backup file (dump.rdb) into your Redis directory and start the server to restore Redis data.

Use CONFIG command of Redis as shown below.

Redis Backup 3

The Redis server is installed in the following directory.

"/var/lib/redis"


BGSAVE Command

There is an alternate command named BGSAVE which is used to create Redis backup.

This command will start the backup process and run this in the background.

Syntax

Example

Redis Backup 4
Next TopicRedis Security




Latest Courses