Kafka管理与监控——broker宕机后无法消费问题
背景
因磁盘满了,导致kafka所有的服务器全部宕机了,然后重启kafka集群,服务是启动成功了,但有一些报错:
broker1:

broker2:

broker3:一直在刷以下错误信息

虽然报了这些错,但kafka正常启动了,通过命令测试了集群能正常生产和消费消息,但是看kafka-manager界面,出现副本未分配的异常情况:

检查消费这些主题的程序,果然是消费失败了,一直在刷如下异常信息:

注:图中IP的是broker3节点
截止到这里可以看出,broker3节点出问题了,导致消费者程序连接不上,但奇怪的话,通过命令创建主题测试,在broker3节点又能消费。
继续分析broker3的日志,报错原因:集群要求的副本数是2,但只找到1个。

于是查看相关主题的详细信息,发现确实ISR列表中是少了副本

猜测由于宕机后,有些节点落后leader太多,还没有追上来,所以脱离了ISR列表,于是等它自动追上来。
等到第2天一看,还是一样,没有追上来,于是决定重启kafka集群,发现有些分区的会自动扩展成2,出问题的那些分区还是没有。。。。

然后想通过重新分配分区指定副本,看能否让它自动恢复一下副本,通过以下命令进行处理:
bin/kafka-reassign-partitions.sh --zookeeper 10.0.xx.x:,10.0.xx.x:,10.0.xx.x: --reassignment-json-file reassign.json --execute
reassign.json文件内容:
{"version":, "partitions":[
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]},
{"topic":"__consumer_offsets","partition":,"replicas":[,]}
]}`

重新分区指定副本的方法也不行,于是修改kafka配置,把集群要求的副本数改为1:
vi server.properties

重启kafka集群后,broker3不在就报错了,在重启消费都程序,也能正常连上kafka进行消费了。
总结:
kafka出现宕机后,副本脱离ISR列表(落后leader太多),按正常来说它会慢慢追上来后在自动重新加入ISR列表中,但我的等了20个小时后还没有,重启kafka集群后也没有恢复。导致服务启动有问题。
现在临时解决方案是调整成1,让它先跑一段时间后,看能否恢复回来,到时在设置成2。
问题:
1、原因尚未找到;
2、这样调整后,kafka会出现数据丢失的情况(出问题期间的数据都丢失了)。
Kafka管理与监控——broker宕机后无法消费问题的更多相关文章
- 假如Kafka集群中一个broker宕机无法恢复,应该如何处理?
假如Kafka集群中一个broker宕机无法恢复, 应该如何处理? 今天面试时遇到这个问题, 网上资料说添加新的broker, 是不会自动同步旧数据的. 笨办法 环境介绍 三个broker的集群, z ...
- 万答#4,延迟从库加上MASTER_DELAY,主库宕机后如何快速恢复服务
欢迎来到 GreatSQL社区分享的MySQL技术文章,如有疑问或想学习的内容,可以在下方评论区留言,看到后会进行解答 当主库宕机后,延迟从库如何才能"取消"主动延迟,以便恢复服务 ...
- 解Bug之路-记一次对端机器宕机后的tcp行为
解Bug之路-记一次对端机器宕机后的tcp行为 前言 机器一般过质保之后,就会因为各种各样的问题而宕机.而这一次的宕机,让笔者观察到了平常观察不到的tcp在对端宕机情况下的行为.经过详细跟踪分析原因之 ...
- 记一次 oracle 数据库在宕机后的恢复
系统:redhat 6.6 oracle版本: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production 问题描述: ...
- 实验:zk master宕机后,临时节点在新的master上是否存在,结果出人意料
一.实验 实验说明:3台zk集群,主要验证:master上的客户端,在master上建立临时节点,当master宕机时,其他follower选为主后,临时节点是否存在. 主要是通过此来验证,基于zk的 ...
- 『叶问』#41,三节点的MGR集群,有两个节点宕机后还能正常工作吗
『叶问』#41,三节点的MGR集群,有两个节点宕机后还能正常工作吗 每周学点MGR知识. 1. 三节点的MGR集群,有两个节点宕机后还能正常工作吗 要看具体是哪种情况. 如果两个节点是正常关闭的话,则 ...
- 关于mysql主从架构master宕机后,请求转移问题解决办法
mysql架构:一主一从 问题一:有两台mysql数据库,已做好主从.如果运行某一天master服务器mysql故障导致前端请求无法处理怎么办? 答:将前端需要数据库处理的请求转移到slave机上. ...
- Kafka管理与监控——彻底删除topic
一.配置 server.properties 设置 delete.topic.enable=true 如果没有设置 delete.topic.enable=true,则调用kafka 的delete命 ...
- Kafka管理与监控——调优
1.JVM参数配置优化 如果使用的CMS GC算法,建议JVM Heap不要太大,在4GB以内就可以.JVM太大,导致Major GC或者Full GC产生的“stop the world”时间过长, ...
随机推荐
- dos中查找端口的PID,并在任务管理器中处理端口
本文来源https://www.cnblogs.com/lsyf/p/8979012.html 1.查看所有端口进程 首先点击开始菜单选择运行,接着在运行对话框中输入“cmd”,回车打开命令提示符窗口 ...
- 1128 聚合查询 orm字段及属性
目录 一 聚合查询 1. 级联 级联删除 级联更新 2. 聚合函数 使用 aggregate 使用场景 3. 分组查询 语法 使用 annotate 代码 4. F与Q查询 F查询 Q查询 二 ORM ...
- Django中的日期和时间格式 DateTimeField
创建django的model时,有DateTimeField.DateField和TimeField三种类型可以用来创建日期字段,其值分别对应着datetime().date().time()三中对象 ...
- django2.0报错Cannot import name 'urlresolvers'
刚刚从django1.1迁移到django2.0中出现一个意外的报错: google 了下,在stack.overflow上解释是说django2.0 把原来的 django.core.urlreso ...
- Educational Codeforces Round 75 (Rated for Div. 2) A. Broken Keyboard
链接: https://codeforces.com/contest/1251/problem/A 题意: Recently Polycarp noticed that some of the but ...
- javascript权威指南第22章高级技巧
HTML <!DOCTYPE html> <html> <head> </head> <body> <div style=" ...
- 51nod 1488 帕斯卡小三角 斜率优化
思路:斜率优化 提交:\(2\)次 错因:二分写挂 题解: 首先观察可知, 对于点\(f(X,Y)\),一定是由某个点\((1,p)\),先向下走,再向右下走. 并且有个显然的性质,若从\((1,p) ...
- POJ P2279 Mr. Young's Picture Permutations 题解
每日一题 day14 打卡 Analysis 五维dpf[a1,a2,a3,a4,a5]表示各排从左端起分别占了a1,a2,a3,a4,a5个人时合影方案数量然后我们枚举a1,a2,a3,a4,a5从 ...
- 三十五.MySQL读写分离 MySQL多实例 、MySQL性能调优
1.实现MySQL读写分离 搭建一主一从结构 配置maxscale代理服务器 测试分离配置 1.1 搭建一主一从结构 192.168.4.51 主 192.168.4.52 从 测试OK 1. ...
- javaweb+上传大文件
我们平时经常做的是上传文件,上传文件夹与上传文件类似,但也有一些不同之处,这次做了上传文件夹就记录下以备后用. 这次项目的需求: 支持大文件的上传和续传,要求续传支持所有浏览器,包括ie6,ie7,i ...