Two persistence mechanisms of RDB and AOF
Rdb:snapshot---the stored format is in binary format, is the default persistence mode, and periodically saves data from memory to disk by a pre-defined policy: Data file defaults to Dump.rdb
So there are two types of RDB storage mechanisms:
A. Clients can also use the Save or Bgsave command explicitly to start the snapshot save mechanism
B. Saving using a Save policy in a configuration file
Save: Saves the snapshot in the main thread and blocks all client requests (if there is a large amount of data in memory, it will block the customer request for a long time)
Bgsave: Asynchronously saved, the main process is not blocked, does not affect the client's request, and when it is saved, it will fork out a child process to write the in-memory snapshot to disk;
RDB disadvantage: In the event of an unexpected shutdown or power outage, data will be lost, the data is lost after the last snapshot
Default save (snapshot) policy
Save 900 1
Save 300 10
Save 60 10000
Save "": Empty inside quotation marks, indicating the ability to turn off the RDB
Stop-writes-on-bgsave-error Yes: The default is yes when an error occurs while the backup is stopped
Rdbcompression Yes: If the Rdb file is compressed to save space (compression consumes CPU), the default is Yes
Rdbchecksum Yes: Check code detection for RDB image file (for error detection), default Yes
Dbfilename Dump.rdb:rdb Storage file name, default is Dump.rdb
Dir:rdb File Save File location
This article is from the "burning Years of Passion" blog, please be sure to keep this source http://liuzhengwei521.blog.51cto.com/4855442/1931465
Redis Persistent RDB