Kafka Streams 代理连接超时设置 [英] Kafka Streams broker connection timeout setting

查看:45
本文介绍了Kafka Streams 代理连接超时设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用 kafka-streams 2.3.1,我刚刚注意到,如果 broker 宕机,streams 应用程序似乎满足于尝试永远尝试连接.

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.

在此过程中,流状态为 REBALANCING,因此没有好的方法可以确定连接是否刚刚中断.

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?

推荐答案

很遗憾,这个问题没有好的解决方法.这个问题实际上是一个消费者问题,因为消费者只是尝试重新连接,但没有向 Kafka Streams 显示它的内部状态.此外,不可能将消费者配置为在某些时候放弃.

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.

有一个KIP给Kafka Streams添加一个DISCONNECTED"状态,但是最近没有太大进展... 很复杂... https://cwiki.apache.org/confluence/display/KAFKA/KIP-457%3A+Add+DISCONNECTED+status+to+Kafka+Streams

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

这篇关于Kafka Streams 代理连接超时设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆