RDB

1: Introduction to RDB

    Write a snapshot of the dataset in memory to disk within a specified time interval, which is a Snapshot snapshot in the jargon. When it is restored, the snapshot file is directly read into memory. The rdb saves the dump.rdb file by default

Two: configuration location

    Configure rdb in SNAPSHOTTING (snapshot) in redis's redis.conf file:

    1.save

      save number of write operations per second

      RDB is a compressed Snapshot of the entire memory. The data structure of RDB can configure composite snapshot trigger conditions. The
      default is 10,000 changes within 1 minute, or 10 changes within 5 minutes, or 1 change within 15 minutes. Second, is to trigger the creation of the RDB file

      If you want to disable the RDB persistence strategy, just don't set any save command, or pass an empty string parameter to save.

    2.stop-writes-on-bgsave-error

  If it is configured as no, it means that you don't care about data inconsistency or other means of discovery and control

   3. rdbcompression

   rdbcompression: For snapshots stored to disk, you can set whether to compress the storage. If so, redis will use the
   LZF algorithm for compression. If you don't want to consume CPU for compression, you can set this function to be turned off

   4. rdbchecksum

   rdbchecksum: After the snapshot is stored, redis can also use the CRC64 algorithm to check the data, but this will increase the performance consumption by about 10%. If you want to get the maximum performance improvement, you can turn off this function

Three: Manually trigger RDB

    Use the save or bsave command

    Save: just save when saving, nothing else, all blocked

    BGSAVE: Redis will perform snapshot operations asynchronously in the background, and snapshots can also respond to client requests.
    The time of the last successful snapshot can be obtained through the lastsave command

    Note: Execute the flushall command, the dump.rdb file will also be generated, but it is empty and meaningless

Four: Advantages/Disadvantages

    Advantage:

    Suitable for large-scale data recovery, with low requirements for data integrity and consistency

    Disadvantage:

    Do a backup at a certain interval, so if redis goes down unexpectedly, all modifications after the last snapshot will be lost

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325002398&siteId=291194637
RDB