############################## APPEND ONLY MODE ############################### appendonly yes appendfilename "appendonly.aof # appendfsync always appendfsync everysec # appendfsync no 等内核buffer快满了.kernel自动flush
no-appendfsync-on-rewrite no redis有一个正在进行rdb的子进程时,此值为true,就不会产生AOF写 ??? # When rewriting the AOF file, Redis is able to use an RDB preamble in the # AOF file for faster rewrites and recoveries. When this option is turned # on the rewritten AOF file is composed of two different stanzas: # # [RDB file][AOF tail] # # When loading Redis recognizes that the AOF file starts with the "REDIS" # string and loads the prefixed RDB file, and continues loading the AOF # tail. aof-use-rdb-preamble yes
[lemcoden@hadoop01 6379]$ redis-cli 127.0.0.1:6379> set k1 a OK 127.0.0.1:6379> set k1 b OK 127.0.0.1:6379> set k1 c OK 127.0.0.1:6379> get k1 "c" 127.0.0.1:6379> BGREWRITEAOF [lemcoden@hadoop01 6379]$ vim appendonly.aof Backgrou*2 $6 SELECT $1 0 *3 $3 SET $2 k1 $1 c
AOF & RDB混合
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
aof-use-rdb-preamble yes [lemcoden@hadoop01 6379]$ redis-cli 127.0.0.1:6379> set k1 a OK 127.0.0.1:6379> set k1 b OK 127.0.0.1:6379> set k1 c OK 127.0.0.1:6379> get k1 "c" 127.0.0.1:6379> BGREWRITEAOF [lemcoden@hadoop01 6379]$ vim appendonly.aof REDIS0009ú redis-ver^E5.0.5ú redis-bitsÀ@ú^EctimeÂK3·_ú^Hused-memÂÐ^E^M^@ú^Laof-preambleÀ^Aþ^@û^A^@^@^Bk1^Acÿ<84>^Q·<9e>^T"<96>] ~
# Automatic rewrite of the append only file. # Redis is able to automatically rewrite the log file implicitly calling # BGREWRITEAOF when the AOF log size grows by the specified percentage. # # This is how it works: Redis remembers the size of the AOF file after the # latest rewrite (if no rewrite has happened since the restart, the size of # the AOF at startup is used). # # This base size is compared to the current size. If the current size is # bigger than the specified percentage, the rewrite is triggered. Also # you need to specify a minimal size for the AOF file to be rewritten, this # is useful to avoid rewriting the AOF file even if the percentage increase # is reached but it is still pretty small. # # Specify a percentage of zero in order to disable the automatic AOF # rewrite feature.