Redis data is placed in memory. If the machine goes down, the data in the memory will not exist.
Need to be persisted, the data in the memory is saved on the disk, and the data can be restored to the memory the next time it is started. (Recommended learning: Redis Video Tutorial)
AOF append only file (all redis operation commands are recorded in the aof file), restore the data and execute it again.
Features: Save every second, the data is relatively complete, and it consumes performance.
Disadvantages: The data generated between 0-1 seconds is lost and cannot be saved. However, the save mode can be modified to generate an AOF every time redis is changed
AOF opening settings:
Modify the redis.conf file as shown below:
Set appendonly to yes
Redis can enable AOF, use AOF to restore data, the data exists in the /usr/local/redis/bin/appendonly.aof file
More Redis related technical articles , please visit the Redis Getting Started Tutorial column to learn!
The above is the detailed content of How to recover redis downtime data. For more information, please follow other related articles on the PHP Chinese website!