简体   繁体   English

如何解决 Kafka 代理中的网络和 memory 问题?

[英]How to solve network and memory issues in Kafka brokers?

When using kafka, I got intermittent two network related errors.使用 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

[configuration environment] 【配置环境】

 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

Both of these errors are caused by loss of network communication.这两个错误都是由网络通信丢失引起的。

If these errors occur, Kafka will work to expand or shrink the ISR partition several times.如果发生这些错误,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

I understand that these errors are caused by network problems, but I'm not sure why the break in the network is occurring.我了解这些错误是由网络问题引起的,但我不确定为什么会发生网络中断。

And if this network disconnection persists, I got the following additional error: Error when handling request(topics=null} java.lang.OutOfMemoryError: Java heap space如果此网络断开仍然存在,我收到以下附加错误: Error when handling request(topics=null} java.lang.OutOfMemoryError: Java heap space

I wonder what causes these and how can I improve this?我想知道是什么原因造成的,我该如何改善呢?

The network error tells you that one of the brokers is not running, which means it cannot connect to it.网络错误告诉您其中一个代理没有运行,这意味着它无法连接到它。 As per experience the minimum heap size you can assign is 2Gb.根据经验,您可以分配的最小堆大小为 2Gb。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM