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

Configuration method of Redis persistence

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces "the configuration method of Redis persistence". In the daily operation, I believe that many people have doubts about the configuration method of Redis persistence. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "Redis persistence configuration method". Next, please follow the editor to study!

Redis persistent configuration

There are two ways to persist Redis: 1 snapshot 2 is a log

Configuration options for Rdb Snapshot

If there is one write in save 9001 / 900, a snapshot is generated.

Save 1000 / / if there are 1000 writes in 300 seconds, a snapshot is generated

Save 60 10000 / / if there are 10000 writes in 60 seconds, a snapshot is generated

(if all three options are masked, rdb is disabled)

When there is an error in the stop-writes-on-bgsave-error yes / / background backup process, does the main process stop writing?

Whether the exported rdb file of rdbcompression yes / / is compressed

Rdbchecksum yes / / when importing rbd recovery data, do you want to verify the integrity of rdb?

Dbfilename dump.rdb / / exported rdb file name

The placement path of dir. / rdb

Configuration of Aof

Whether appendonly no # enables the aof log function. If you want to disable aof, set it to no and rename the aof file.

Appendfsync always # every command is immediately synchronized to aof. Safe, slow

Appendfsync everysec # compromise, write once per second

Appendfsync no # write work to the operating system, the operating system to determine the size of the buffer, unified write to aof. Low synchronization frequency and high speed

No-appendfsync-on-rewrite yes: # do you want to stop synchronizing aof while exporting rdb snapshots?

Auto-aof-rewrite-percentage 100 # aof file size compared to the size of the last rewrite, when the growth rate is 100%, rewrite

Auto-aof-rewrite-min-size 64mb # aof file, overridden when it exceeds at least 64m

The BGREWRITEAOF background process overrides AOF

BGSAVE background saves rdb Snapshot

SAVE saves rdb Snapshot

Last saved time of LASTSAVE

Note: will aof be lost if it stops synchronization during dump rdb?

Answer: no, all operations are cached in the memory queue. After the dump is completed, the operation will be unified.

Note: what is aof rewriting?

A: aof rewriting refers to the data in memory, inverted into commands, and written to the .aof log.

To solve the problem that aof log is too large.

Q: if both rdb files and aof files exist, who is the priority to restore data?

A: aof

Q: can the two be used at the same time?

A: yes, and it is recommended

Q: which is faster to recover, rdb or aof?

Answer: rdb is fast, because it is a memory map of data and is directly loaded into memory, while aof is a command that needs to be executed one by one.

At this point, the study on the "configuration method of Redis persistence" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Servers

Wechat

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

12
Report