1. AOF Persistence Introduction
Redis supports RDB and AOF, two persistence mechanisms, the purpose is to avoid the problem of data loss caused by process exit.
RDB persistence: The process of generating point-in-time snapshots of the current process data and saving them to the hard disk to avoid accidental data loss.
AOF persistence: Record each write command in an independent log, and re-execute the commands in the AOF file when restarting to restore data.
Redis RDB persistence mechanism source code analysis and
use of annotation AOF: In the redis.conf configuration file, set appendonly to yes, and the default is no.
2. Implementation of
AOF persistence All comments of AOF persistence: Redis AOF persistence mechanism source code comments
2.1 Commands are written to disk
2.1.1 Commands are written to the buffer
quote