Redis persistent configuration

Source: Internet
Author: User

I. RDB snapshot persistence

1. Configure in redis. conf

Save 900 1 # When you refresh a snapshot to a hard disk, It is triggered only when the two requirements are met, that is, at least one keyword changes after 900 seconds.
Save 300 10 # At least 10 keywords change after 300 seconds.
Save 60 10000 # At least 10000 keywords change after 60 seconds.

# Note the preceding three option annotations to block the persistent storage of RDB snapshots

Stop-writes-on-bgsave-error yes # The background storage error stops writing.
Rdbcompression yes # Use lzf to compress RDB files.
Rdbchecksum yes # verify when storing and loading RDB files.
Dbfilename dump. RDB # Set the RDB file name.
Dir./# Set the working directory, which is written to the RDB file. /Var/RDB can write absolute addresses

2. test performance
# Note: Execute the 10 thousand command
./Redis-benchmark-N 10000


Ii. aof log persistence

1. Configure in redis. conf

Appendonly yes # Whether to only log Yes (Enabled) | no (disabled)

Appendfilename "appendonly. aof" # aof file storage location/var/AOF can write absolute address

# Appendfsync no # System Buffer, unified write, fast
# Appendfsync always # The system does not buffer, Direct Writing, slow, and less data loss
Appendfsync everysec # compromise, write once per second

No-appendfsync-on-Rewrite yes # When the RDB snapshot is being exported, do you want to stop synchronizing aof yes? | no (do not stop)
Auto-Aof-rewrite-percentage 100 # the size of the aof file is 100% higher than the size of the last rewrite.
Auto-Aof-rewrite-Min-size 64 MB # aof file, which must be overwritten at least 64 MB

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.