Two kinds of Redis persistence mechanism RDB and AOF

table of Contents


RDB

principle

Trigger When

AOF

principle

Open AOF

aof log file description

Trigger When

aof rewriting mechanism

Mixed redis4.0 persistence mechanism

to sum up


 

rdb persistent file name: dump.rdb. Redis.conf specified in the configuration file stored path dir

RDB

principle

Trigger When

Specify the location of persistent files redis.conf configuration file, the data will be restored accordingly at the start redis:

AOF

principle

Redis operating principle is to log additional way to write files, read operations are not recorded.

Save command is redis

Use in the file "/" to search the contents of the file:

Open AOF

Start and log redis:

aof log file name:

aof log file description

Trigger When

① lost data comparison:

rdb and aof data will be lost, but some more serious rdb lost data. aof will not lose more than two seconds of data.

② log file size comparison:

aof> rdb rdb log file is stored in binary format, aof is stored in string format.

aof rewriting mechanism

auto-aof-rewrite-percentage 100

It represents a ratio of the size of the trigger, 64M after being rewritten only 30M, then triggered rewritten reaches 60M, if 80 is set, then triggered when rewriting 30M + 30 * 0.8 = 54M.

Mixed redis4.0 persistence mechanism

to sum up

Published 824 original articles · won praise 369 · views 790 000 +

Guess you like

Origin blog.csdn.net/a772304419/article/details/104049206