问题描述
我一直在使用下面的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
:在重用其他工具的逻辑的情况下,添加对安全连接bby的支持非常容易.如果这样做,请考虑将补丁发送到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的Kafka中的最新偏移量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!