当前位置:网站首页>Redis data loss problem
Redis data loss problem
2022-07-23 18:07:00 【Grab】
common Redis Data loss
- DBA/RD Misoperation execution flushall/flushdb Such orders .
- Expired key deleted .
- Elimination strategy delete data .
- Because the client buffer memory is used too much , Cause a large number of keys to be LRU Eliminate .
- Auto restart after main library failure , Possible data loss .
- The problem of network partition , It may cause short-term write data loss .
- Data loss due to asynchronous replication .
- Data loss due to cleft brain .
Because the client buffer memory is used too much , Cause a large number of keys to be LRU Eliminate
The memory size of the client buffer is difficult to limit , The amount of memory they consume will be calculated in used_memory Inside ; If not used properly , This leads to excessive buffer memory usage , achieve maxmemory Limit ;( Caching scenarios ) Will cause a large number of keys to be eliminated , At worst, all keys will be cleaned up , Buffer keyless can be eliminated , Write failure . Equivalent to the entire buffer failure , Great impact on business .
Auto restart after main library failure , Possible data loss .
Point in time T1, The main library is closed due to failure , Because there is a daemon for automatic restart , Point in time T2 The main library is pulled up again , because (T2-T1) The time interval is too small , Not up to Redis The master-slave switching judgment duration of the cluster or sentinel ; In this way, the main database is found from the database runid Changed or disconnected , The main database will be fully synchronized rdb clear , And clean up your own data . To ensure performance ,Redis The main database often does not set data persistence , So at what time T2 Start the main library , It is likely to be an empty instance ( Or a long time ago rdb file ). The time interval between such problems , Generally less than 1 minute , The monitoring alarm may not be perceptible .
The problem of network partition , It may cause short-term write data loss .
This kind of problem occurs, and data loss is rare , Network partition ,Redis The cluster or sentinel is judging the time window of failover , Data written to the original master database during this period ,5 second ~15 Write volume in seconds .
Data loss due to asynchronous replication .
because master->slave Replication of is asynchronous , So maybe some data hasn't been copied to slave,master It's down. , At this point, some of the data is lost .
Data loss due to cleft brain .
Some master The machine is suddenly out of the normal network , With others slave The machine can't be connected , But actually master Still running . At this point the sentry might think master It's down. , Then open the election and the others slave Switch to master. There will be two in the cluster master, It's called cleft brain .
At this time, although some slave It's switched to master, But maybe client There's no time to switch to the new master, Still keep writing to the old master Data may have been lost . So old master When we recover again , Will be treated as a slave Hang on to the new master Up , Your data will be cleared , From the new master Copy the data .
Solution :
By means of redis.conf Configure and control synchronization time to reduce data loss .
# It requires at least 1 individual slave, Data replication and synchronization delays cannot exceed 10 second
min-slaves-to-write 1
# If it's all slave, The latency of data replication and synchronization exceeds 10 Second , that master Will refuse to accept any request
min-slaves-max-lag 10边栏推荐
- Test and development experience
- 薪资高压线
- Leetcode: Jianzhi offer II 115. reconstruction sequence [graph theory thinking + in degree consideration + topological sorting]
- js:图片url转base64编码
- IDEA Download Sources报错 Connection refused的解决方法
- 能与PowerDesigner媲美的数据库建模工具PDMan[通俗易懂]
- 活动报名:如何零基础快速上手开源的 Tapdata Live Data Platform?
- Leetcode skimming: dynamic programming 05 (different paths II)
- jps详解
- Seal player IP and machine code and unlock the blocked tutorial
猜你喜欢

Salary high voltage line

配置Gom引擎登錄器出現錯誤提示:沒有發現必備補丁文件!

Sentinel 介绍与微服务整合

Sentinel 安装图解

微服务雪崩问题及解决方案

Mutual certification of product compatibility between tapdata and Youxuan database

idea debug常用操作

“如今,99.9% 以上的代码都是垃圾!”

C language -- implementation of address book and screentogif

Seal player IP and machine code and unlock the blocked tutorial
随机推荐
c语言--通讯录的实现与ScreenToGif
MySQL执行Alter table xx add column报Duplicate entry错误
Solutions to sap Hana database backup failure
vim 笔记
"Nowadays, more than 99.9% of the code is garbage!"
Detailed explanation of JPS
Activity Registration: how to quickly start the open source tapdata live data platform on a zero basis?
mysql字段修改
[216] go language standard library package name
网页基础模版
Rust中的函数function与方法method的区别
rust猜数字游戏
ContextLoaderListener vs DispatcherServlet
Sentinel introduction and microservice integration
一次线上频繁FullGC的排查
LeetCode_动态规划_中等_120.三角形最小路径和
服务器环境搭建
LDAP unified authentication service solution [easy to understand]
Machine learning (9) - Feature Engineering (3) (supplementary)
Trust counts the number of occurrences of words in the file