Khóa học miễn phí Redis – Backup nhận dự án làm có lương

Redis – Backup



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

Syntax

Following is the basic syntax of redis SAVE command.

127.0.0.1:6379> SAVE 

Example

Following example creates a backup of the current database.

127.0.0.1:6379> SAVE  
OK 

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

Restore Redis Data

To restore Redis data, move Redis backup file (dump.rdb) into your Redis directory and start the server. To get your Redis directory, use CONFIG command of Redis as shown below.

127.0.0.1:6379> CONFIG get dir  
1) "dir" 
2) "/user/tutorialspoint/redis-2.8.13/src" 

In the output of the above command /user/tutorialspoint/redis-2.8.13/src is the directory, where Redis server is installed.

Bgsave

To create Redis backup, an alternate command BGSAVE is also available. This command will start the backup process and run this in the background.

Example

127.0.0.1:6379> BGSAVE  
Background saving started

Khóa học lập trình tại Toidayhoc vừa học vừa làm dự án vừa nhận lương: Khóa học lập trình nhận lương tại trung tâm Toidayhoc