The method of recovering redis downtime data
This article will explain in detail the methods of restoring redis downtime data. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Redis data is kept in memory. If the machine goes down, the data in memory does not exist.
You need to persist and save the data in memory on disk, and you can restore the data to memory the next time you boot.
AOF append only file (all operation commands to redis are recorded in the aof file), recover the data, and execute it again.
Features: saved per second, the data is relatively complete, consuming performance.
Disadvantages: the data generated between 0-1 second is lost and cannot be saved, but you can modify the save mode to generate an AOF every time you change redis
AOF enable settings:
Modify the redis.conf file as shown below:
Set appendonly to yes
Redis can open AOF and use AOF to recover data. The data exists in / usr/local/redis/bin/appendonly.aof file.
This is the end of the method of recovering redis downtime data. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.