1. Rdb
When the condition is met, Redis will fork (create) A new thread, the data in memory will be written to a temporary file, the persistence process is finished, and then replace the last persisted file with this temporary file, the whole process, the main process does not do any IO operation, Ensures very high performance, at which time the master process can read and write operations. The disadvantage of RDB data persistence is that the last persisted data may be lost, and when the machine goes down or fails at the last persisted time intercept, the last data is not persisted.
The role of Fork:fork is to replicate a process that is the same as the current process, and all data (variables, environment variables, program counters, etc.) of the new process is consistent with the original process, but is a completely new process, also known as the subprocess of the original process.
If the amount of data in memory is very large, the RDB persisted temporary files will be very large, almost 1 time times the original file, performance has been reduced.
If the write operation is to be persisted immediately, the command can be executed: Save
Save is fully blocked and Bgsave is asynchronous.
Flushall also generates DUMP.RDB files, empties all database data, and saves them in the Dump.rdb file.
Shutdown also produces Dump.rdb files that store in-memory data in the Dump.rdb file
Persistent Rdb and aof for Redis