Aof,rdb is a mechanism for two types of redis persistence. Used for the recovery of Redis after a crash.
The features of the RDB are as follows:
Code:
Fork a process, traverse hash table, and use copy on write to save the entire db dump .
Save, shutdown, slave command will trigger this operation.
particle size ratio is large, if save, shutdown, slave before crash, then the middle of the operation has no way to recover .
AOF has the following characteristics:
Code:
Write the instructions, continue to write to a similar log file. (similar to exporting SQL from databases such as PostgreSQL, only write operations are logged)
Can be set to backup every second. the value of Appendfsync is set to everysec
The granularity is small, after crash, only then crash did not have time to do the log the operation cannot recover.
The two differences are that one is the continuous use of log records to write operations, crash after the use of log recovery ; One is usually write operations do not trigger the write, only manually submit the Save command, or close the command, only trigger the backup operation .
The standard of choice is to see if the system is willing to sacrifice some performance in exchange for higher cache consistency (aof), or is willing to write frequently, do not enable backup in exchange for higher performance, when manually run save, then do Backup (RDB). The RDB is a bit more eventually consistent .
So master Redis aof in exchange for higher cache consistency , No backup from Redis RDB for higher performance
The difference between the RDB and aof persistence for Redis