Home >Backend Development >PHP Tutorial >Two persistence methods of redis - rdb snapshot and aof log
This article mainly talks about the two persistence methods of redis, namely rdb snapshot and aof log. It has certain learning value and interested friends can take a look.
Persistence means that the data that needs to be stored will not be lost even if the power is cut off/restarted, that is, the data is stored in the device, usually in the hard disk.
There are two ways to persist redis:
1-rdb snapshot
2-aof log, which can be configured by configuring the redis.conf file
Configuration options of rdb snapshot:
After the configuration is completed, restart redis to take effect. There is a drawback to using rdb persistence. If there are exactly 10 write operations when it is about to reach 300 seconds, a snapshot will be generated at this time. The snapshot is generated After the completion, there was a new write operation, and the power was cut off at this time.
After the call came in, redis was started to automatically import the rdb file. The data only had the data before the snapshot was generated, and part of the data after that was lost. So use Arrived at aof log persistence:
Related tutorials: Redis video tutorial
The above is the detailed content of Two persistence methods of redis - rdb snapshot and aof log. For more information, please follow other related articles on the PHP Chinese website!