Redis persistence mechanism

Source: Internet
Author: User
Tags redis time interval
Redis persistence mechanism
Redis is an in-memory database that supports persistence, which means that Redis often needs to synchronize the in-memory data to the hard disk to persist.
Redis persistence two ways RDB and AOF


1.snapshotting (snapshot) default mode
Writes the in-memory snapshot to a binary file, by default Dump.rdb can be set to automatically make snapshot persistence.
We can configure Redis to automatically take snapshots if more than M key is modified within n seconds
Snapshotting settings:
Save 900 1 900 seconds if more than one key is modified then initiate a snapshot save
Save 300 10 300 seconds more than 10 keys are modified to initiate snapshot saves
Save 60 10000 60 seconds for more than 10,000 keys to initiate a snapshot

How to 2.append-only file (abbreviated AOF)
Because the snapshot is done at a certain time interval, Redis downtime may occur all modifications after the last snapshot. aof
is more persistent than snapshot mode, because when using AOF, Redis appends each command received to the
command. When the Redis reboot executes the write command saved in the file, the contents of the database are re-built in memory.
This file under Bin appendonly.aof.aof is not immediately written to the hard disk and can be forced to write to the hard disk via configuration file modification.
AOF settings:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.