The event in requested index is outdated and cleared (the requested history has been cleared ) 问题和修复
来源:互联网 发布:阿里云怎么监控 编辑:程序博客网 时间:2024/06/05 16:27
- 现象
etcd高负载时客户端 watch etcd 返回401
报错如下:ERROR: watch error 401: The event in requested index is outdated and cleared (the requested history has been cleared [15047837/15040498]) [15048836]
此时etcd 会断开客户端 的watcher,index 从上次断开前的modifyIndex到重新watch起来的latestIndex之间的事件会丢失掉,造成线上变更丢失现象。 原因分析
- 原理层面
etcd只保留所有etcd键中最近的1000个事件的响应,当watch的起始index值不在最近的这1000个就会报上述index过期错误 - 代码层面:
go-etcd client中的watchOnce每获得一个事件就会从当前事件的modifyIndex + 1 重新watch
在处理watch事件时没有采用异步的方式,这样watch会阻塞住直到响应处理结束,当集群负载较大或者相应处理时间较长时modifyIndex + 1可能会不在最新的1000个index中,出现上述index过期的现象
- 原理层面
优化方案
两点思路:
- 处理事件的函数改成异步方式,这样就不会block etcd watch,预期可以显著减小变更丢失现象
- 感知到事件后,采用get方式获取事件,不完全依赖于watch的结果,这样虽然不主观上避免index过期的现象,但是可以完全补偿变更丢失掉的事件
阅读全文
0 0
- The event in requested index is outdated and cleared (the requested history has been cleared ) 问题和修复
- The requested item has been unloaded[enums in monodevelop ]
- 使用JBoss Guvnor报错Local History has been cleared
- Access to the requested resource has been denied
- Access to the requested resource has been denied
- the requested operation has failed!
- apache遇到The requested operation has failed的问题
- HTTP Status 403 - Access to the requested resource has been denied
- HTTP Status 403 - Access to the requested resource has been denied
- TOMCAT "Access to the requested resource has been denied" 的解决办法
- HTTP Status 403 - Access to the requested resource has been denied
- [Tomcat]HTTP Status 403 - Access to the requested resource has been denied
- HTTP Status 403 – Access to the requested resource has been denied
- HTTP Status 403 - Access to the requested resource has been denied
- tomcat HTTP Status 403 - Access to the requested resource has been denied
- HTTP Status 403 - Access to the requested resource has been denied
- GameCenter authenticate:GKErrorDomain Code=2 "The requested operation has been cancelled."
- HTTP Status 403 - Access to the requested resource has been denied
- 商品展示案例
- 欢迎使用CSDN-markdown编辑器
- mysql 修改root密码和开启远程访问
- 剑指Offer-24
- 支持向量机讲解
- The event in requested index is outdated and cleared (the requested history has been cleared ) 问题和修复
- python cookbook学习笔记十四:函数(1)
- Python数据分析与挖掘实战(开发流程及常用库安装)
- linux sed 批量替换字符串
- CentOS 7下安装Python3.5
- 什么是工程师文化?
- UNIX ftp命令
- spring boot 官方文档翻译之 集成redis
- 怎么解决浏览器的兼容