RDB

RDB yes Redis The first way to persist . There are two Redis Commands can be used to build RDB file , One is SAVE, The other is BGSAVE.SAVE It will block
Redis Server process , At the time of execution Redis The server blocks all commands sent by clients .
redis> SAVE OK
BGSAVE A child process execution is derived , The client's commands can still be processed while executing , But the client is rejected SAVE and BGSAVE The order of , delay BGREWRITEAOF
command .
redis> BGSAVE Background saving started
conditions for execution

SAVE The command blocks the server , So it can only be done manually .BGSAVE Can be executed without blocking , So it can be configured save
Option to have the server automatically execute it every once in a while . For example, we can provide the following configuration to the server :
save 900 1 save 300 10 save 60 10000
Then any one of the following three conditions can be executed :

* Server in 900 In seconds, at least 1 Revision .
* Server in 300 In seconds, at least 10 Revision .
* Server in 60 In seconds, at least 10000 Revision .
In order to achieve this function , The server maintains a record of the number of changes since the last save dirty Counter and a record of the last save time lastsave attribute . Periodic operation function
serverCron Default each 100 Once in a millisecond , One of its jobs is checking save Whether the conditions set by the option are met , If it is satisfied, it will be carried out BGSAVE command .

Document content

RDB The document has multiple parts , Include handshake field

Technology
©2019-2020 Toolsou All rights reserved,
QT Delete directory and file Java aggregate ------LinkedHashMap Underlying principle I've been drinking soft water for three years ? What is the use of soft water and water softener Java Xiao Ming A+B About wechat payment body( Product description ) Problems encountered Digital rolling lottery program 3 species Python data structure ,13 Creation methods , This is the conclusion , Great ! Huawei Mate 40 Pro+ 5G exposure : Leica film lens , Ceramic body What's the difference in server prices ? Operators Website visitors' mobile phone number capture