Redis backup recovery
Note: [to restore, simply move the backup files to the redis installation directory, restart the service, if it is RDB persistence, just move dump.rdb to the installation directory, if it is aof persistence, just move appendonly.aof to the installation directory, if it is RDB+AOF persistence, move dump.rdb and appendonly.aof at the same time] Redis data backup and recovery
The Redis SAVE command is used to create a backup of the current database.
Grammar
The basic syntax for redis Save commands is as follows:
Redis 127.0.0.1 redis 6379 > SAVE instance redis 127.0.0.1 redis 6379 > SAVE OKBgsave create redis backup files can also be created using the command BGSAVE, which is executed in the background. Instance 127.0.0.1 6379 > BGSAVEBackground saving started
This command creates the dump.rdb file in the redis installation directory.
Recover data
If you need to restore data, simply move the backup files (dump.rdb and appendonly.aof) to the redis installation directory and start the service. You can use the CONFIG command to get the redis directory, as follows:
Redis 127.0.0.1 dir 6379 > CONFIG GET dir1) "dir" 2) "/ usr/local/redis/bin"
The redis installation directory output from the above command CONFIG GET dir is / usr/local/redis/bin.