Redis persistence Policy

Source: Internet
Author: User

1. redis, as a memory database, needs to store a large amount of user data, but the data stored in redis is stored in the memory. Due to power failure or downtime, memory data will certainly be lost. To prevent data loss, usePersistence ModeTo back up memory data;

When redis memory contains data, there are two methods through its own policy. One isRDB Mode, One isAof (default); Data persistence based on the settings of its own mode;Both RDB and aof have their own persistent files;

When redis is restarted, it loads the persistent File Based on the name of the persistent file specified in the configuration file to restore memory data;

2. RDB mode:

2.1 features: RDB ModeRegularly persists data in the memory.If you are allowed to lose a small amount of data, the RDB mode is preferred, because the RDB mode isMemory Snapshot;Fast backup speed;

2.2 BACKUP command: (execute the redis BACKUP commandRun redis-CLI on the client.)

Save (manual backup) ------- will cause thread blocking. redis update is allowed only when the backup operation is complete;

Bgsave (background backup) ---- indicates running in the background without causing thread blocking. It will pick up time for data backup;

2.3 backup method:

Save 900 1 in 900 seconds, redis performs an update operation, then backup once

Save 300 10 in 300 seconds, redis performs 10 update operations, then backup once

Save 60 10000 in 60 seconds, redis performs 10000 update operations, then backup once

3. aof mode: (Real-time Data Backup is supported. This mode is equivalentRecords all user operations); Persistence files are saved in plaintext without encryption. (After aof mode is enabled, RDB mode does not take effect !!!)

3.1 features: Real-time Data Backup, good security, and slow persistence compared with the RDB mode;

Aof persistent files are large in size. It takes a long time to recover data;

3.2 aof persistence policy:

Appendfsync always ---------- each operation will be backed up

Appendfsync everysec ------- backup once per second

Appendfsync no ---------------- no operation

 

Redis persistence Policy

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.