使用kafka时,间歇性地出现两个与网络相关的错误。
1. Error in fetch kafka.server.replicafetcherthread$fetchrequest connection to broker was disconnected before the reponse was read
2. Error in fetch kafka.server.replicafetcherthread$fetchrequest Connection to broker1 (id: 1 rack: null) failed
[[配置环境]
Brokers: 5 / server.properties: "kafka_manager_heap_s=1g", "kafka_manager_heap_x=1g", "offsets.commit.required.acks=1","offsets.commit.timeout.ms=5000", Most settings are the default. Zookeepers: 3 Servers: 5 Kafka:0.10.1.2 Zookeeper: 3.4.6
这两个错误均是由于网络通信丢失引起的。
如果发生这些错误,Kafka将努力扩展或缩小ISR分区几次。
expanding-ex) INFO Partition [my-topic,7] on broker 1: Expanding ISR for partition [my-topic,7] from 1,2 to 1,2,3
shrinking-ex) INFO Partition [my-topic,7] on broker 1: Shrinking ISR for partition [my-topic,7] from 1,2,3 to 1,2
我知道这些错误是由网络问题引起的,但是我不确定为什么会发生网络中断。
并且如果此网络断开仍然存在,则出现以下附加错误:Error when handling request(topics=null} java.lang.OutOfMemoryError: Java heap space
我想知道是什么原因造成的,如何改善呢?
网络错误告诉您其中一个代理未运行,这意味着它无法连接。根据经验,您可以分配的最小堆大小为2Gb。