Kafka Streams broker connection timeout setting

核能气质少年 提交于 2021-01-29 13:48:36

问题


We are using kafka-streams 2.3.1 and I've just noticed that if broker is down, the streams app seems to be content to try to keep trying connecting forever.

new KafkaStreams(createTopology(), properties()).start()
 o.apache.kafka.clients.NetworkClient - [AdminClient clientId=test] Connection to node -1 (broker/127.0.0.1:9092) could not be established. Broker may not be available.

The streams state is REBALANCING while this is going on so there's no good way to determine if the connection is just broken.

Is there a way to set either a timeout or a number of retries for broker(s) connection attempts?


回答1:


There is unfortunately no good workaround for this problem. The issue is actually a consumer issue, as the consumer just tries to reconnect but does not surface it's internal state to Kafka Streams. Also, it's not possible to configure the consumer to give up at some point.

There is a KIP to add a "DISCONNECTED" state to Kafka Streams, but there was not much progress lately... It's complicated... https://cwiki.apache.org/confluence/display/KAFKA/KIP-457%3A+Add+DISCONNECTED+status+to+Kafka+Streams



来源:https://stackoverflow.com/questions/59403196/kafka-streams-broker-connection-timeout-setting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!