当前位置:网站首页>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边栏推荐
- IDEA这些既好用又好玩的三十多个宝贝插件你还不知道吗?「建议收藏」
- TP & smart use diary
- [215] Gin Framework connection to MySQL Database
- rust统计文件中单词出现的次数
- 几种运维工具的对比
- (十一)STM32——IO引脚复用与映射
- MySQL8.0.23四次重装都失败在 'Writing configuration file'
- LDAP统一认证服务解决方案[通俗易懂]
- Rust中的函数function与方法method的区别
- There is an error prompt when configuring the GOM engine login: the necessary patch file is not found!
猜你喜欢

ContextLoaderListener vs DispatcherServlet

Keras II classification problem

Console calculator developed based on C language
![[216] go language standard library package name](/img/14/bd12be4204ed44e114b1311f08c9e3.jpg)
[216] go language standard library package name

Tapdata 与优炫数据库完成产品兼容性互认证

ContextLoaderListener vs DispatcherServlet

【216】go语言标准库包名

CSDN custom T-shirts are waiting for you to get, and the benefits of new programmer are coming!

The larger the convolution kernel, the stronger the performance? An interpretation of replknet model

Keras之二分类问题
随机推荐
变分法 (Calculus of Variations)
Data concentration analysis and data distribution
MySQL执行Alter table xx add column报Duplicate entry错误
信息论 (Information Theory): Introduction and information measures
Docker installs redis and starts it as a configuration file
TYPE-C 转OTG(USB2.0传输数据)+PD充电协议芯片 乐得瑞LDR6028/LDR6023SS
Type-C to OTG (USB2.0 data transmission) + PD charging protocol chip ledrui ldr6028/ldr6023ss
Phpstrom shortcut key
Leetcode skimming: dynamic programming 05 (different paths II)
Sentinel 安装图解
mysql字段修改
The difference between function and method in rust
IDEA Download Sources报错 Connection refused的解决方法
Common operations of idea debug
QT multithread instance and the fifth parameter of connect [easy to understand]
MySQL8.0.23四次重装都失败在 'Writing configuration file'
Qt多线程实例与connect第五个参数[通俗易懂]
Legendary setup GEE engine tutorial configuration micro terminal
sublime text使用技巧
CSDN定制T恤等你来拿,《新程序员》福利来袭!