Data persistence scheme of redis

There are two persistence schemes for Redis

1. Rdb mode : snapshot mode, which periodically persists the data in memory to the hard disk. It is the default form of data persistence in Redis.

Rdb: The disadvantage is: the data has not been updated to the disk, and the power is suddenly cut off, resulting in incomplete data.

Configuration in redis.conf:

 

 

2. Aof method : append only file records each write operation in the form of a log, and saves all instructions for redis database operations (commands for adding, deleting, and modifying operations, excluding read instructions) to a file. Only append files are allowed and cannot be modified. . When data is restored, all the instructions in the file will be executed from beginning to end at the beginning of redis startup, the data will be reconstructed, and the data restoration work has been completed.

The configuration of the aof method in redis.conf:

You only need to modify appendonly yes (the default is no, and aof persistence is not enabled)

If the two methods are started at the same time, the aof persistence method will be used to restore the database from the file.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324751660&siteId=291194637