当前位置:网站首页>[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
边栏推荐
- Map的扩容机制
- [together Shangshui Shuo series] day 7 content +day8
- "C and pointer" - Chapter 13 function of function pointer 1 - callback function 1
- [untitled]
- 今天很多 CTO 都是被干掉的,因为他没有成就业务
- 一起上水碩系列】Day 9
- Using the ethtool command by example
- Personal outlook | looking forward to the future from Xiaobai's self analysis and future planning
- Communication - how to be a good listener?
- Redis使用Lua脚本简介
猜你喜欢

How to set up altaro offsite server for replication

"C and pointer" - Chapter 13 function pointer 1: callback function 2 (combined with template to simplify code)
![[minesweeping of two-dimensional array application] | [simple version] [detailed steps + code]](/img/b0/aa5dce0bb60c50eea907de9e127d6c.jpg)
[minesweeping of two-dimensional array application] | [simple version] [detailed steps + code]

一起上水碩系列】Day 9

Brief introduction of realsense d435i imaging principle

Shanghai daoning, together with American /n software, will provide you with more powerful Internet enterprise communication and security component services

大二困局(复盘)

"C and pointer" - Chapter 13 function of function pointer 1 - callback function 1

Method of finding prime number

QT read write excel -- qxlsx insert chart 5
随机推荐
Introduction to redis using Lua script
2022.6.30DAY591
Redis cannot connect remotely.
Using the ethtool command by example
Btrfs and ext4 - features, strengths and weaknesses
Brief introduction of realsense d435i imaging principle
Final review Day8
配置xml文件的dtd
Common exceptions when Jenkins is released (continuous update...)
为什么网站打开速度慢?
[minesweeping of two-dimensional array application] | [simple version] [detailed steps + code]
redis 无法远程连接问题。
3dslam with 16 line lidar and octomap
[trivia of two-dimensional array application] | [simple version] [detailed steps + code]
Download the corresponding version of chromedriver
Source insight automatic installation and licensing
Making coco datasets
[function explanation (Part 2)] | [function declaration and definition + function recursion] key analysis + code diagram
Shanghai daoning, together with American /n software, will provide you with more powerful Internet enterprise communication and security component services
【一起上水硕系列】Day 7 内容+Day8
