背景

因磁盘满了,导致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宕机后无法消费问题的更多相关文章

  1. 假如Kafka集群中一个broker宕机无法恢复,应该如何处理?

    假如Kafka集群中一个broker宕机无法恢复, 应该如何处理? 今天面试时遇到这个问题, 网上资料说添加新的broker, 是不会自动同步旧数据的. 笨办法 环境介绍 三个broker的集群, z ...

  2. 万答#4,延迟从库加上MASTER_DELAY,主库宕机后如何快速恢复服务

    欢迎来到 GreatSQL社区分享的MySQL技术文章,如有疑问或想学习的内容,可以在下方评论区留言,看到后会进行解答 当主库宕机后,延迟从库如何才能"取消"主动延迟,以便恢复服务 ...

  3. 解Bug之路-记一次对端机器宕机后的tcp行为

    解Bug之路-记一次对端机器宕机后的tcp行为 前言 机器一般过质保之后,就会因为各种各样的问题而宕机.而这一次的宕机,让笔者观察到了平常观察不到的tcp在对端宕机情况下的行为.经过详细跟踪分析原因之 ...

  4. 记一次 oracle 数据库在宕机后的恢复

    系统:redhat 6.6 oracle版本: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production 问题描述: ...

  5. 实验:zk master宕机后,临时节点在新的master上是否存在,结果出人意料

    一.实验 实验说明:3台zk集群,主要验证:master上的客户端,在master上建立临时节点,当master宕机时,其他follower选为主后,临时节点是否存在. 主要是通过此来验证,基于zk的 ...

  6. 『叶问』#41,三节点的MGR集群,有两个节点宕机后还能正常工作吗

    『叶问』#41,三节点的MGR集群,有两个节点宕机后还能正常工作吗 每周学点MGR知识. 1. 三节点的MGR集群,有两个节点宕机后还能正常工作吗 要看具体是哪种情况. 如果两个节点是正常关闭的话,则 ...

  7. 关于mysql主从架构master宕机后,请求转移问题解决办法

    mysql架构:一主一从 问题一:有两台mysql数据库,已做好主从.如果运行某一天master服务器mysql故障导致前端请求无法处理怎么办? 答:将前端需要数据库处理的请求转移到slave机上. ...

  8. Kafka管理与监控——彻底删除topic

    一.配置 server.properties 设置 delete.topic.enable=true 如果没有设置 delete.topic.enable=true,则调用kafka 的delete命 ...

  9. Kafka管理与监控——调优

    1.JVM参数配置优化 如果使用的CMS GC算法,建议JVM Heap不要太大,在4GB以内就可以.JVM太大,导致Major GC或者Full GC产生的“stop the world”时间过长, ...

随机推荐

  1. ASP.NET 下配置请求大小、请求时间等参数

    在邮件发送系统或者其他一些传送文件的网站中,用户传送文件的大小是有限制的,因为这样不但可以节省服务器的空间,还可以提高传送文件的速度.下面介绍如何在Web.Config文件中配置限制上传文件大小与时间 ...

  2. webpack 配置react脚手架(三):eslint 及优化

    首先谨记 eslint的官网:  http://eslint.cn/ 1 安装eslint  npm i eslint -D 2.在根目录下新建文件 .eslintrc { "extends ...

  3. idea插件开发

    用过的group ProjectViewPopupMenu 项目.目录的右键弹出菜单 EditorPopupMenu 编辑器里面的右键弹出菜单 调出右键菜单的关键字 show context menu

  4. mongoose 5.0 链接数据库 代码保存

    const mongoose = require('mongoose'); const dbSrc = 'mongodb://localhost/douban-trailer' mongoose.Pr ...

  5. C# 通过 参数返回 C++ 指针

    参数返回 C++ 指针 C++ 代码 Extern_C BASECORELIBRARY_API char * GetFileByteArray(wchar_t * BinfilePath, wchar ...

  6. 31、[源码]-AOP原理-AnnotationAwareAspectJAutoProxyCreato机

    31.[源码]-AOP原理-AnnotationAwareAspectJAutoProxyCreato机

  7. SQL切分字符串成int和for xml path

    切分字符 SqlServer切割字符串示例: --declare @StrDId nvarchar(2000) --set @StrDId='100,200,400,500,600' --转换ID,防 ...

  8. 洛谷 P3956 棋盘 题解

    每日一题 day5 打卡 Analysis 深搜+剪枝+瞎jb判断 1.越界 2.这个点无色 3.当前的价值已经比答案大 三种情况要剪枝 我搜索里判断要不要施法的时候没判断上一次有没有施法,白调了0. ...

  9. Oracle 修改SID --不建议修改

    1.登录数据库查看SID select instance_name,status from v$instance; 2.关闭数据库 shutdown immdiate; 3.修改/etc/oratab ...

  10. jQuery的ajax()方法提交数组问题

    http://blog.csdn.net/thc1987/article/details/7278269 解决办法是添加一个属性 traditional:true $.ajax({    type: ...