Redis Persistent Configuration
There are 2 ways to persist Redis 1 snapshot 2 is log
configuration options for Rdb snapshots
Save 1//within the range of 1 writes , a snapshot is generated
Save +// if There are more than five writes in a second , a snapshot is generated
Save 10000// if There are 10000 writes in a second , a snapshot is generated
( these 3 options are masked , the rdb is disabled )
Stop-writes-on-bgsave-error Yes// background backup process error , does the main process stop writing ?
Rdbcompression Yes// the exported rdb file is compressed
Rdbchecksum Yes// import RBD when restoring data , do not verify The integrity of the RDB
Dbfilename Dump.rdb//The rdb filename of the guide
Dir.///rdb Placement Path
configuration of the Aof
AppendOnly No # whether to turn on the aof log feature, to disable AOF set to No and rename the AoF file
Appendfsync always # every 1 commands , sync to aof immediately. Safety , Slow Speed
Appendfsync everysec # compromise, write 1 times per second
Appendfsync No # writes to the operating system , determines the buffer size by the operating system , and writes uniformly to the aof. Low Synchronization frequency , Fast Speed ,
No-appendfsync-on-rewrite Yes: # in the process of exporting an RDB snapshot , either stop synchronizing aof
Auto-aof-rewrite-percentage #aof File size compared to the size of the last rewrite , when the growth rate 100% , rewrite
Auto-aof-rewrite-min-size 64mb #aof file , at least 64M , override
Note : In the dump RDB process , if the aof stop synchronization , will not 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 a memory map of the data , loaded directly into memory , and aof It's an order , it needs to be executed
Redis Persistent Configuration