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-- rdb persistence

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

Share

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

Persistence: generally speaking, there is still data on the next boot, and the data will not be lost after the power outage and will be stored on disk.

Redis:rdb snapshot persistence

After every N minutes or N write operations, dump data from memory to form a RDB file. Compress and put it in the backup directory.

Detailed description of parameters:

Look up from the bottom

1 key change in save 9001 # 900s

10 key changes in save 30010 # 300s

Save 60 10000 # 60 has 10000 writes in 60 seconds and should be saved

Stop-writes-on-bgsave-error yes # background storage error stop writing

When the redis server main process is exported, the client requests and cannot give back. In the new version of redis, a child process is derived specifically to export the process. If there are not enough disks during the export process, but the process is still working. There are bound to be data inconsistencies. Here are the parameters, and if there is an error during the rdb export, then stop the client from writing.

Rdbchecksum yes restarts the server and detects when importing memory from rdb

Dbfilename dump rdb # set the rdb file name

Dir # sets the working directory, and the rdb file will be written to that path

Experiment:

1, create the dir directory under / var/

2. Modify the redis configuration file and add the above parameters, such as dir / var/dir to specify the rdb storage path

3. Restart the process and delete the original files generated by rdb

4. Use self-contained tools to generate 10000 key

. / redis-benchmark-n 10000

Number of requests processed:

99.76% get site

"www.zixue.it"

Note: there are certain shortcomings, because there will be abnormal power outage. For example, the data is saved once before, and again at a later point. Rdb can't do it at this time. I will continue to talk about the way AOF works later.

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

Wechat

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

12
Report