Kafka消费异常处理
org.apache.kafka.clients.consumer.CommitFailedException: Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that the time between subsequent calls to poll() was longer than the configured max.poll.interval.ms, which typically implies that the poll loop is spending too much time message processing. You can address this either by increasing the session timeout or by reducing the maximum size of batches returned in poll() with max.poll.records.
at org.apache.kafka.clients.consumer.internals.ConsumerCoordinator$OffsetCommitResponseHandler.handle(ConsumerCoordinator.java:775)
at org.apache.kafka.clients.consumer.internals.ConsumerCoordinator$OffsetCommitResponseHandler.handle(ConsumerCoordinator.java:726)
工作中遇到的kafka异常和解决办法 记录一下
原文地址https://blog.csdn.net/shibuwodai_/article/details/80678717
异常
异常的主要信息:
a) CommitFailedException
b) Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that the time between subsequent calls to poll() was longer than the configured max.poll.interval.ms, which typically implies that the poll loop is spending too much time message processing. You can address this either by increasing the session timeout or by reducing the maximum size of batches returned in poll() with max.poll.records.
其实如果我们对其中的参数,或是对消费的机制比较了解,这个问题就很好解决。当我看到这个异常,我很开心,因为我知道我能通过此异常了解一下Kafka Consumer 消费消息的大致过程。心态是好的~~~
其实现在看这个异常是说:该Consumer不能提交offset了,因为它已经出局了,是因为你的处理小时时间长于你要报告给server的时间。同时还告诉我们怎么处理:要么增加超时时间,要么减少每次poll回来的消息个数。
主要问题在于,何为session timeout?maximum size of batches?poll(timeout)中timeout什么意思?
处理过程
a) 找官网doc
版本:1.1.0
有效信息:
换成通俗易懂的人话:
下边这个例子如果理解不上,请通读全文后,再回来理解一下笔者的意思
------------------------------------分割线------------------------------------
------------------------------------分割线------------------------------------
通过上边的例子,我们大致清楚了max.poll.interval.ms?maximum size of batches?
max.poll.interval.ms:消费者最大心跳时间间隔
maximum size of batches:消费者每次获取消息的个数
什么时候发送心跳呢?是poll()方法被调用发送心跳吗?那poll(timeout)中timeout是什么意思呢?
官网对poll(timeout)中timeout的解释如下:
- Parameters:
- timeout - The time, in milliseconds, spent waiting in poll if data is not available in the buffer. If 0,returns immediately with any records that are available currently in the buffer,else returns empty. Must not be negative.
这个我费了很大力气都没有给它翻译成人话……
Kafka消费异常处理的更多相关文章
- 涨姿势了解一下Kafka消费位移可好?
摘要:Kafka中的位移是个极其重要的概念,因为数据一致性.准确性是一个很重要的语义,我们都不希望消息重复消费或者丢失.而位移就是控制消费进度的大佬.本文就详细聊聊kafka消费位移的那些事,包括: ...
- kafka 消费
前置资料 kafka kafka消费中的问题及解决方法: 情况1: 问题:脚本读取kafka 数据,写入到数据库,有时候出现MySQL server has gone away,导致脚本死掉.再次启 ...
- 分享一些 Kafka 消费数据的小经验
前言 之前写过一篇<从源码分析如何优雅的使用 Kafka 生产者> ,有生产者自然也就有消费者. 建议对 Kakfa 还比较陌生的朋友可以先看看. 就我的使用经验来说,大部分情况都是处于数 ...
- Go语言学习之12 etcd、contex、kafka消费实例、logagent
本节内容: 1. etcd介绍与使用 2. ElastcSearch介绍与使用 1. etcd介绍与使用 概念:高可用的分布式key-value存储,可以使用配置共享和服务发现 ...
- Kafka消费时报错:Producer connection to xxx:9092 unsuccessful
使用kafka消费数据时报Producer错误,具体错误如下: kafka.producer.SyncProducer:103 Producer connection to xxx:9092 unsu ...
- Kafka设计解析(十三)Kafka消费组(consumer group)
转载自 huxihx,原文链接 Kafka消费组(consumer group) 一直以来都想写一点关于kafka consumer的东西,特别是关于新版consumer的中文资料很少.最近Kafka ...
- 双十一问题:kafka消费能力低下原因思考
抛去cpu.内存等机器原因,在每个分区皆分配一个进程消费的情况下,利用扩机器来提高kafka消费速率已无能为力 此时发现,在实际洪峰时段的消费速率元达不到先前压测时的消费速率 原因思考: 1.洪峰时段 ...
- Kafka消费不到数据的特殊情况
我大约是把kafka消费不到数据的特殊情况都经历了一遍了吧= =. kafka消费不到数据的原因,首先检查配置之类的,如是否设置了group.id,对应的topic是否正确等等,这些不多说. 下面是我 ...
- Kafka消费分组和分区分配策略
Kafka消费分组,消息消费原理 同一个消费组里的消费者不能消费同一个分区,不同消费组的消费组可以消费同一个分区 Kafka分区分配策略 在 Kafka 内部存在两种默认的分区分配策略:Range 和 ...
随机推荐
- Bagging和Boosting的区别
转:http://www.cnblogs.com/liuwu265/p/4690486.html Bagging和Boosting都是将已有的分类或回归算法通过一定方式组合起来,形成一个性能更加强大的 ...
- 乌龙之Ignoring query to other database问题
问题现象: [root@zxdb05 ~]# mysql -root -pEnter password: Welcome to the MySQL monitor. Commands end wit ...
- spoj high
matrixtree定理裸体,学了行列式的n^3解法,(应该是能应用于所有行列式): 代码是参考某篇题解的... #include<iostream> #include<cstrin ...
- Alpha阶段敏捷冲刺(二)
1.提供当天站立式会议照片一张. 2.每个人的工作 (有work item 的ID),并将其记录在码云项目管理中: 昨天已完成的工作. 祁泽文:上网了解了艾宾浩斯遗忘曲线算法. 徐璐琳:找交互模块的源 ...
- Codeforces Round #540 (Div. 3)--1118D2 - Coffee and Coursework (Hard Version)
https://codeforces.com/contest/1118/problem/D2 和easy version的主要区别是,数据增加了. easy version采用的是线性查找,效率低 在 ...
- HDOJ1024--Max Sum Plus Plus(动态规划)UnSolved
Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we ...
- noip第24课作业
1. 马走日 [问题描述] 马在中国象棋以日子形规则移动.请编写一段程序给定n*m大小的棋盘,以及马的初始位置(x,y),要求不能重复经过棋盘上的同一个点,计算马可以有多少途径遍历棋盘上的所有点. ...
- hdu 2688
这题,因为要统计之前有多少个数比当前的数小,所以我用的树状数组 基本代码就是这样,还是比较好想的,只不过我没想出来罢了 #include <iostream> #include <c ...
- HDU 2829 区间DP & 前缀和优化 & 四边形不等式优化
HDU 2829 区间DP & 前缀和优化 & 四边形不等式优化 n个节点n-1条线性边,炸掉M条边也就是分为m+1个区间 问你各个区间的总策略值最少的炸法 就题目本身而言,中规中矩的 ...
- A - Playground
My kid's school cleared a large field on their property recently to convert it into a playing area. ...