There are 2 ways to persist Redis 1 Snapshot 2 is log
1. Configuration options for RDB snapshots
save 900 1 // 900, 1 writes, resulting in a snapshot save 300 1000 // save 60 10000 //
is generated
(These 3 options are masked , then the RDB is disabled ) You can look upside down if you understand.
// when the background backup process fails, does the main process stop writing? // whether the exported Rdb file is compressed // to verify the integrity of the RDB when importing RBD recovery data // the Rdb file name that is being directed out // placement path for an RDB
2, the Aof configuration
AppendOnly No # Open the AoF log feature Appendfsync always # every 1 commands, sync to aof Safe, Slow Appendfsync everysec # Compromise, write 1 times per second Appendfsync No # write work to the operating system, determined by the operating system buffer size, unified write to AoF. Low synchronization frequency, fast speed,
no-appendfsync-on-Rewrite yes: # in the process of exporting an RDB snapshot, either stop synchronizing Aofauto #aof文件大小比起上次重写时的大小, growth rate 100% , overriding auto-aof-rewrite-min-size 64MB #aof文件, at least 64M
3. Matters of attention
Note: In the dump RDB process , aof if the synchronization is stopped, will it be lost ?
A: No , all operations are cached in the memory queue , and after the dump is complete, the operation is Unified .
Note : What does aof rewrite mean ?
A: aof rewrite refers to the memory of the data , the inverse of the command , written to the . AoF log .
To resolve The problem that the AOF log is too large .
Q : If the rdb file, and the aof file are present , who will be the first to recover the data ?
Answer : aof
Q : Can 2 types be used at the same time ?
A: Yes , and recommend it.
Q : Which of the Rdb and AoF recovers quickly when recovering
A : The RDB is fast , because it is the memory map of the data , directly loaded into the memory , and aof is the command , need to be executed
Redis Persistent Configuration