当前位置:网站首页>Aof of redis persistence
Aof of redis persistence
2022-07-18 02:01:00 【_ ady】
redis Persistence is aof
Concept
Log every write operation in the form of a log , take Redis All written instructions executed are recorded ( Reading operation does not record ), Only files can be added but not rewritten ,redis At the beginning of startup, it will read the file and rebuild the data , In other words ,redis In case of restart, execute the write instruction from the front to the back according to the contents of the log file to complete the data recovery
Aof What is kept is appendonly.aof file
Profile location

AOF start-up / Repair / recovery
Normal recovery
1 Modify the configuration file 
2 start-up redis, Write 2 Time , then flushall. see aof file , Recovery found no data , stay aof Delete... From the file flushall command , Start again redis, Data found to exist .


Abnormal recovery
1 Backup aof file , modify aof file , Joining is not in line with redis Content of grammar
2 Try to start redis, Can't start
3 Use Redis-check-aof --fix Make repairs
4 restart redis, normal 

Rewrite
Concept :AOF By means of document addition , The documents will become larger and larger to avoid this , New rewrite mechanism , When AOF When the file size exceeds the set threshold ,Redis Will start AOF The content of the file is compressed , Keep only the smallest instruction set that can recover data . You can use commands bgrewriteaof
principle :AOF When files continue to grow and become too large , Meeting fork A new process to rewrite the file ( Also write temporary documents first and then rename), Traverse the data in memory of the new process , Each record has one Set sentence . rewrite aof Operation of file , Not reading the old aof file , Instead, the database contents in the whole memory are rewritten with a new command aof file , It's a bit like a snapshot .
Trigger mechanism :Redis It will record the last time it was rewritten AOF size , The default configuration is when AOF The file size is last rewrite Double the size and the file is larger than 64M Trigger when
Advantages and disadvantages
advantage :
1 Sync per change :appendfsync always Synchronous persistence Every time there is a data change, it will be recorded to the disk immediately Poor performance but good data integrity
2 A second synchronous :appendfsync everysec Asynchronous operations , Record every second If it goes down in a second , There is data loss
3 Out of sync :appendfsync no No synchronization
shortcoming :
1 Data from the same data set aof Documents are much larger than rdb file , Recovery is slower than rdb
2Aof Operating efficiency is slower than rdb, The efficiency of synchronization strategy per second is better , Out of sync efficiency and rdb identical
summary

边栏推荐
- Software testing W model
- Engineering monitoring vibrating wire sensor wireless acquisition instrument external digital sensor
- C language implementation of three chess
- 51 single chip microcomputer serial port baud rate (keep it and don't look everywhere)
- Codeforces Round #736 (Div. 2) (A-D)
- Find string length
- Introduction to redis
- Nodes and clients for getting started with eth
- [HCIA] data communication network foundation
- apt-get 无法使用 语法报错
猜你喜欢

“OpenCvSharp.Mat“的类型初始值设定项引发异常

百度搜索基础信息设置规范,有哪些我们需要注意的问题呢?

【C】 Pointer advanced

Officially released vs Code 1.69

redis持久化之aof

For collecting lost rights and interests, is it still worth digging into the content of enterprise stations?

软件测试W模型

2022-07-14 第五小组 修身课 学习笔记(every day)

51单片机串口波特率(保留一下以后就不用到处找了)
![[HCIA] data communication network foundation](/img/fd/80aecb783083bc73e6d7472e6107ff.png)
[HCIA] data communication network foundation
随机推荐
第四十五期:系统学习能力
Idea setting / modifying shortcut keys
2021-09-18
“OpenCvSharp.Mat“的类型初始值设定项引发异常
对比一下优质【测试报告】模板与你自己的有何不同?
送你的代码上太空,与华为云一起开发“最伟大的作品”
工程监测振弦传感器无线采集仪外接数字传感器
What is the difference between VDD, VCC, VSS, GND and ground?
matlab总结
接口开发不用写Controller、Service、Dao、Mapper、XML、VO,全自动生成!
Matlab drawing examples
[Verilog] 32-bit single precision floating-point number comparison size
树莓派串口通信
300000 prize pool is waiting for you to fight! Natural language processing (NLP) competition collection is coming
Analysis of problems related to C language pointer
eth入门之节点与客户端
解析协同办公“协同”为何意,数字化办公又如何轻松“破题”?
High weight website has not been filed. Is it normal to reduce the weight in batches?
第三十七期:mapState浅析
第四十一期:一个项目正在走向失败