简体   繁体   English

有什么方法可以确认Kafka的消费者属性?

[英]Any way to confirm Kafka consumer properties?

I am trying to confirm that Kafka Consumer config is working correctly. 我想确认Kafka Consumer配置是否正常工作。 I am setting some consumer property values to non-default values (eg session.timeout.ms, heartbeat.interval.ms). 我将一些消费者属性值设置为非默认值(例如session.timeout.ms,heartbeat.interval.ms)。 Is there a way to query them and ensure that they have been set to the specific values I define in my properties? 有没有办法查询它们并确保它们已设置为我在属性中定义的特定值?

I've searched online, but I can't seem to find any guidance on how to query group controller for these configurations. 我在网上搜索过,但我似乎无法找到有关如何查询这些配置的组控制器的任何指导。

The closest approach I found is using kafka-consumer-groups.sh, but that does not provide all the details. 我发现最接近的方法是使用kafka-consumer-groups.sh,但这并未提供所有细节。

Any ideas? 有任何想法吗?

Thanks for any suggestions! 谢谢你的任何建议!

Some further clarification based on feedback: I do use logging, however I don't think that's what I want to check. 根据反馈进一步澄清:我确实使用了日志,但我不认为这是我想要检查的。

Let me try and clarify a bit further. 让我试着进一步澄清一下。 Let's take session.timeout.ms as an example. 我们以session.timeout.ms为例。 That setting is used by the group coordinator to determine if a particular consumer is alive. 组协调器使用该设置来确定特定的消费者是否还活着。 So I would think the group coordinator (which is a kafka broker) must be aware of this setting server-side. 所以我认为组协调员(这是一个kafka经纪人)必须知道这个设置服务器端。 So if I set session timeout to a non-default value, I am wondering if there is a way to query the broker to get this setting. 因此,如果我将会话超时设置为非默认值,我想知道是否有办法查询代理以获取此设置。 If I use logging, I will get the configuration setting on the object that's created when I created the Kafka consumer. 如果我使用日志记录,我将在创建Kafka使用者时创建的对象上获取配置设置。 It is not providing me with values from the broker. 它没有向我提供经纪人的价值。 I hope this clarifies the ask. 我希望这澄清了这个问题。 Please correct me if my understand is wrong. 如果我的理解是错误的,请纠正我。

If you setup logging via log4j or Slf4j, the ConsumerConfig object gets printed out in the application logs and will show all loaded properties 如果通过log4j或Slf4j设置日志记录,则ConsumerConfig对象将在应用程序日志中打印出来并显示所有已加载的属性

Otherwise, they might be shown in JMX as well, but I'm not too sure 否则,它们也可能在JMX中显示,但我不太确定

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

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