What persistence mechanism Redis is? Their advantages and disadvantages?

Redis persistence mechanism provides two mechanisms for RDB and AOF:

1, RDBRedis DataBase) persistent way: is a snapshot of a dataset half way persistent mode) record all key-value pairs redis database, written to a temporary file at some point in time data.

After the persistence, persistence replace the previous file with the temporary file, to data recovery.

advantage:

1, only one file dump.rdb, convenient persistence.

2, disaster recovery is good, a file can be saved to disk security.

3, to maximize performance, fork child process to complete the write operation, so that the main process continues to process commands, so is the IO maximized. Use a separate child process to persist, the main process does not make any IO operation, ensuring high performance redis)

4. large data sets, with respect to promoter higher than the efficiency of the AOF.

Disadvantages:

1, data security is low. RDB is a time lag for persistence, redis If a failure occurs between persistence, data loss can occur. So this approach is more suitable for data requirements are not stringent time)

2, AOFAppend-only file) persistent way: all the command-line recording format redis command request protocol fully persistent storage) aof saved as a file.

advantage:

1, data security, persistence may be configured appendfsync aof properties, there Always, once for each command to the recording operation on a file aof.

2, by append mode write files, even if the server is down halfway, data consistency problem can be solved by redis-check-aof tool.

3, rewrite mode AOF mechanism. Before AOF file has not been rewrite (rewrite will merge command when the file is too large), you can delete some of these commands (such as misuse of flushall))

Disadvantages:

1, AOF files larger than RDB files, and the recovery is slow.

2, the data set large, lower efficiency than the start rdb

Guess you like

Origin www.cnblogs.com/it-carry/p/11645697.html