通过 CMD 获取 SSL Enabled Kafka 中的最新偏移量 [英] Get the latest offsets in SSL Enabled Kafka via CMD
问题描述
我一直在使用下面的 CMD 从已打开纯文本端口的 Kafka 队列中获取最新的偏移量
I have being using the below CMD to get the latest offsets in from a Kafka Queue which has plain-text port open
kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list server:9092 --topic sample_topic --time -1
但是,现在我们只打开了 SSL 端口,所以我尝试将 SSL 详细信息作为属性文件传递
But, now we only have the SSL port open, so I tried passing the SSL details as a property file
kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list server:9093 --topic sample_topic --time -1 --consumer-config /path/to/file
出现以下错误 -
Exception in thread "main" joptsimple.UnrecognizedOptionException: consumer-config is not a recognized option
如何将 SSL 详细信息传递给此命令?这些是 kafka-run-class.sh kafka.tools.GetOffsetShell 的所有可用参数
How do I pass the SSL details to this command? These are all the available arguments for kafka-run-class.sh kafka.tools.GetOffsetShell
--broker-list <String: hostname:and port,...,hostname:port>
--max-wait-ms <Integer: ms>
--offsets <Integer: count>
--partitions <String: partition ids>
--time <Long: timestamp/-1(latest)/-2
--topic <String: topic>
推荐答案
遗憾的是 kafka.tools.GetOffsetShell
仅支持 PLAINTEXT 连接.这个工具用得不多,也没有人费心更新.
Unfortunately kafka.tools.GetOffsetShell
only supports PLAINTEXT connection. This tools is not used a lot and nobody has bothered updating it.
根据您的用例,您有几个选择:
Depending on your use case, you have a few options:
使用
kafka-consumer-groups.sh
工具:假设你有一个消费组从该主题消费,这个工具显示每个分区的日志结束偏移
Use the
kafka-consumer-groups.sh
tool: Assuming you have a consumer group consuming from that topic, this tool display the log end offsets of each partitions
补丁kafka.tools.GetOffsetShell
:通过重用其他工具的逻辑,添加对安全连接的支持非常容易.如果这样做,请考虑向 Kafka 发送补丁 =)
Patch kafka.tools.GetOffsetShell
: It's realtively easy to add support to secured connections bby reusing logic from the other tool. If you do so, consider sending a patch to Kafka =)
编写一个小工具,调用 Consumer.endOffsets()
Write a tiny tool that calls Consumer.endOffsets()
这篇关于通过 CMD 获取 SSL Enabled Kafka 中的最新偏移量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!