Discussion on redis problem

discuss a few questions, thank you!

1 the working principle of aof storage is used by Magi Redis?

2 how does aof rewrite work? In which processes the main thread and the generated new thread play a role respectively.

Jun.22,2022

AOF workflow: the command is appended to the aof_buf buffer, synchronized according to the AOF buffer synchronization file strategy, the aof file volume is compressed for file rewriting, and the aof file is loaded for data recovery after redis restart.

aof rewriting principle: bgrewriteof triggers aof rewriting, and the parent process forks the child process. After the fork operation is completed, the parent process continues to respond to the command to write the buffer to the hard disk according to the corresponding synchronization strategy, and the child process writes to the new aof file according to the memory snapshot and the command merging rules. After the new aof file is written, the child process sends a signal to the parent process, and the parent process rewrites the buffer data to the new aof file. The new aof file replaces the old one.


how aof storage works: https://redisbook.readthedocs...

Menu