Redis Backup & Restore: Basic and advance

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

Syntax

SAVE  

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

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

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

Restore Redis Data

You have to pass Redis backup file (dump.rdb) into your Redis listing and start the server to fix Redis data.

Use CONFIG command of Redis as shown below.

The Redis server is hooked up 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 method and run this in the background.

Syntax

BGSAVE  

Example

Next TopicRedis Security