Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Redis persistent configuration

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Redis persistent configuration

one。 Rdb snapshot persistence

1. Configuration, configuring in redis.conf

When save 9001 # refreshes the snapshot to the hard drive, both requirements must be met before it will be triggered, that is, at least 1 keyword will change after 900 seconds.

Save 30010 # must be at least 10 keywords changed after 300 seconds.

Save 60 10000 # must be at least 10000 keywords changed after 60 seconds.

# Note the above three options are annotated, that is, persistent storage of rdb snapshots is blocked.

Stop-writes-on-bgsave-error yes # background storage error stops writing.

Rdbcompression yes # uses LZF to compress rdb files.

Rdbchecksum yes # verifies when storing and loading rdb files.

Dbfilename dump.rdb # sets the rdb file name.

Dir. / # sets the working directory to which the rdb file is written. / var/rdb can write absolute address

two。 Test performance

# Note 10,000 orders were executed

. / redis-benchmark-n 10000

two。 Aof log persistence

1. Configuration, configuring in redis.conf

Appendonly yes # whether only log yes is required (on) | no (off)

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

# appendfsync no # system buffering, unified writing, high speed

# appendfsync always # system does not buffer, write directly, slow, and lose less data

Appendfsync everysec # compromise, write once per second

No-appendfsync-on-rewrite yes # is in the process of exporting rdb snapshots. Do you want to stop synchronizing aof yes (stop) | no (do not stop)

Auto-AOF-rewrite-percentage 100 # aof file size compared to the size of the last rewrite, overridden at a growth rate of 100%

Auto-AOF-rewrite-min-size 64mb # aof file, rewritten if it exceeds at least 64m

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report