Kafka组件研究<六>---- kafka FAQ
2016-12-19 20:52
429 查看
6.1 问题一:ZookeeperConsumerConnector问题
问题描述:kafka.common.ConsumerRebalanceFailedException: …..can't rebalance after 4 retries现象展示:
问题原因:
consumer rebalancing fails (you will see ConsumerRebalanceFailedException): This is due to conflicts when two consumers are trying to own the same topic partition. The log will show you what caused the conflict (search for "conflict in ").
If your consumer subscribes to many topics and your ZK server is busy, this could be caused by consumers not having enough time to see a consistent view of all consumers in the same group. If this is the case, try Increasing rebalance.max.retries and rebalance.backoff.ms.
Another reason could be that one of the consumers is hard killed. Other consumers during rebalancing won't realize that consumer is gone after zookeeper.session.timeout.ms time. In the case, make sure that rebalance.max.retries * rebalance.backoff.ms
问题解决:使用StringSerializer来替换StringEncoder实现序列化。
zookeeper.session.timeout.ms=10000
zookeeper.connection.timeout.ms=15000
zookeeper.sync.time.ms=4000
rebalance.backoff.ms=2000
rebalance.max.retries=10
refresh.leader.backoff.ms=2000
7.2 问题二:Java heap space问题
问题描述:初始化内存空间大小不够现象展示:
问题原因:设置启动java空间大小不够,并且此值kafka中fetch.message.max.bytes=1048576会影响初始化的空间大小
问题解决:根据条件把此值设置,
java -Xms1024m -Xmx2048m -Dproject.dir="$PROJECTDIR" -classpath $CLASSPATH $CLASSNAME & >/dev/null
7.3 问题三:Kafka master 与slave 相互连不上
问题描述:初始化内存空间大小不够现象展示:
Master节点
Slave 节点
问题原因:
问题解决:好像与内存有关
7.4 问题四:Kafka 消费者不消费了
问题描述:利用spring 监听模式进行消费的时候,产生没有消费场景。现象展示:
问题原因:因为监听模式,如果有多个group-id相同,而不记录在Zookeeper的偏移量offset,那将产生虽然进入监听了,但是有可能会收不到消息的问题,因为有可能是其他group-id监听到了,而排查问题中,由于没有配置Zookeeper的相关信息,所以很难定位出问题原因。
问题解决:改变group-id号,不会产生此问题,但是Spring 监听还是需要配置Zookeeper便于好定位问题。
7.5 问题五:Kafka 生产者OutOfMemoryError
问题描述:Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "kafka-producer-network-thread | producer-1683"现象展示:
问题原因:10生产者太多了,长时间不关闭占用内存
问题解决:需要用完后立即关闭
8.6 问题六:Unable to open socket to slave3/IP:2181
问题描述:一直报网络不可达现象展示:
问题解决:好像造成数据的不可用不是这个造成的。
8.7 问题七:Error while fetching metadata with correlation id 4031 : {FACE_INFO_ALG=LEADER_NOT_AVAILABLE}
问题描述:原来kafka机器有三台,由于实际部署需求,缩减了一台,最后只剩下两台。
问题解决:首先在zookeep客户端里面分别执行:
rmr /brokers/topics/FACE_INFO_ALG
rmr /admin/delete_topics
rmr /consumers/faceinfoalg
rmr /config/topics/FACE_INFO_ALG
然后重启zookeep 和kafka服务就可以了。
相关文章推荐
- SpringMVC入门笔记一
- GitHub上README.md教程
- 使用阿里云专属加速器加快获取Docker官方镜像的实战
- 关于Faster R-CNN的一切——笔记2:Fast R-CNN
- 一起talk C栗子吧(第一百九十四回:C语言实例--DIY less命令三 )
- java匿名内部类
- hdu 1300 Pearls
- 数据挖掘中基本概念--数据类型的属性与度量
- 大作业(二)
- 回顶部特效
- (课堂讨论)关于结对编程
- BZOJ2127: happiness
- Labview波形生成器的设置
- 小程序的事件
- 殇
- [Android N]MediaRecorder系列之StagefrightRecorder录制TS流flow(二)
- 尼姆博弈(Nimm's Game)
- 【C++】学习笔记十九——嵌套循环和 4000 二维数组
- HDU 1850 Being a Good Boy in Spring Festival(Nim game)
- ngnix 二 配置ngnix作为一个web服务器