Redis learning (xxi) Redis data backup and recovery

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

grammar

redis Save command basic syntax is as follows:

redis 127.0.0.1:6379> SAVE 

Examples

redis 127.0.0.1:6379> SAVE 
OK

This command creates dump.rdb redis file in the installation directory.


Data recovery

If you need to restore data, simply backup file (dump.rdb) move to redis installation directory and start the service. Get redis directory can  CONFIG  command as follows:

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

The above command  CONFIG GET dir  output redis installation directory is / usr / local / redis / bin .


Bgsave

Redis create backup files can also use the command  bgsave , the command executes in the background.

Examples

127.0.0.1:6379> BGSAVE

Background saving started

 

Guess you like

Origin www.cnblogs.com/qingmuchuanqi48/p/12453643.html