当前位置:网站首页>[teacher Zhao Yuqiang] RDB persistence of redis
[teacher Zhao Yuqiang] RDB persistence of redis
2022-07-03 05:45:00 【Teacher zhaoyuqiang】

Redis There are many different levels of persistence :
- RDB Persistence can generate a point in time snapshot of a dataset within a specified time interval (point-in-time snapshot).
- AOF (Append-only file) Persistent records all write commands executed by the server , And when the server starts , Restore the dataset by reexecuting these commands . AOF All commands in the file are as follows Redis The format of the agreement to save , The new command is appended to the end of the file . Redis You can also do it backstage AOF File rewriting (rewrite), bring AOF The size of the file does not exceed the actual size required to save the dataset state .
- Redis It can also be used at the same time AOF Persistence and RDB Persistence . under these circumstances , When Redis Restart time , It will give priority to AOF File to restore the dataset , because AOF The data set saved by a file is usually larger than RDB The data set saved by the file is more complete .
- You can even turn off persistence , Let the data only exist when the server is running .
One 、RDB The persistence of
working principle : Take a snapshot of the memory at regular intervals , Write data in memory to a file (rdb file ). This is a Redis Default persistence method . When redis Generate dump.rdb When you file , The working process is as follows :
- When reach RDB When generating conditions ,redis The main process fork A subprocess
- fork The subprocess will store the data set in memory dump To the temporary RDB in
- When subprocesses are temporary RDB File write complete ,redis With the new RDB The file replaces the old RDB file
The configuration parameters are as follows :

RDB Sample test : have access to redis-benchmark Stress test , Observe RDB Changes in file size .
bin/redis-benchmark -n 100000 Indicates execution 100000 Operations
Two 、RDB The shortcomings of :
Between two snapshots , If a power failure occurs , Data will be lost . give an example : It's generating rdb after , Insert new value . A sudden power failure , Data may be lost .
3、 ... and 、 monitor RDB:
Redis The most direct way to monitor is, of course, to use what the system provides info The order came to do , Just execute the following command , Can get Redis System status report .
bin/redis-cli info | grep rdb_
- rdb_changes_since_last_save Show that last time RDB Save what changes later key frequency
- rdb_bgsave_in_progress Indicates whether or not the current bgsave operation ,1 It means that it is in progress ;0 Indicates that there is no
- rdb_last_save_time Last save RDB The time stamp of the file
- rdb_last_bgsave_time_sec Last saved time
- rdb_last_bgsave_status Last saved state
- rdb_current_bgsave_time_sec It's preserved now RDB Time spent on documents
边栏推荐
- Method of finding prime number
- Installing altaro VM backup
- 一起上水硕系列】Day 9
- Jetson AGX Orin 平台移植ar0233-gw5200-max9295相机驱动
- Altaro set grandfather parent child (GFS) archiving
- Crontab command usage
- Why should we rewrite hashcode when we rewrite the equals method?
- The request database reported an error: "could not extract resultset; SQL [n/a]; needed exception is org.hibernate.exception.sqlgram"
- Explanation of variables, code blocks, constructors, static variables and initialization execution sequence of static code blocks of Ali interview questions
- [explain in depth the creation and destruction of function stack frames] | detailed analysis + graphic analysis
猜你喜欢

College campus IP network broadcasting - manufacturer's design guide for college campus IP broadcasting scheme based on campus LAN

Altaro o365 total backup subscription plan

Map的扩容机制
![[branch and cycle] | | super long detailed explanation + code analysis + a trick game](/img/aa/543d4f0dcbcd664be963579af77ec9.jpg)
[branch and cycle] | | super long detailed explanation + code analysis + a trick game

Communication - how to be a good listener?
![[advanced pointer (2)] | [function pointer, function pointer array, callback function] key analysis + code explanation](/img/9b/a309607c037b0a18ff6b234a866f9f.jpg)
[advanced pointer (2)] | [function pointer, function pointer array, callback function] key analysis + code explanation

kubernetes资源对象介绍及常用命令(五)-(ConfigMap)

PHP notes are super detailed!!!

一起上水硕系列】Day 9

Redis使用Lua脚本简介
随机推荐
PHP笔记超详细!!!
Notepad++ wrap by specified character
Personal outlook | looking forward to the future from Xiaobai's self analysis and future planning
6.23星期四库作业
ansible防火墙firewalld设置
Troubleshooting of 32GB Jetson Orin SOM failure to brush
2022.7.2day594
MySQL 5.7.32-winx64 installation tutorial (support installing multiple MySQL services on one host)
Linux登录MySQL出现ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
"C and pointer" - Chapter 13 function pointer 1: callback function 2 (combined with template to simplify code)
[set theory] relational closure (relational closure related theorem)
redis 无法远程连接问题。
C 语言文件操作函数大全 (超详细)
Qt读写Excel--QXlsx插入图表5
Communication - how to be a good listener?
"C and pointer" - Chapter 13 advanced pointer int * (* (* (*f) () [6]) ()
ninja: build stopped: subcommand failed.
Obtenir et surveiller les journaux du serveur distant
[explain in depth the creation and destruction of function stack frames] | detailed analysis + graphic analysis
期末复习(DAY6)
