gpt4 book ai didi

apache-kafka - 通过 CMD 在启用 SSL 的 Kafka 中获取最新的偏移量

转载 作者:行者123 更新时间:2023-12-05 07:16:17 26 4
gpt4 key购买 nike

我一直在使用下面的 CMD 从打开了纯文本端口的 Kafka 队列中获取最新的偏移量

kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list server:9092 --topic sample_topic --time -1

但是,现在我们只打开了 SSL 端口,所以我尝试将 SSL 详细信息作为属性文件传递

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 的所有可用参数

--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 连接。这个工具用得不多,也没有人愿意更新它。

根据您的用例,您有几种选择:

  • 使用 kafka-consumer-groups.sh 工具:假设您有一个消费该主题的消费者组,此工具会显示每个分区的日志结束偏移量

  • 补丁 kafka.tools.GetOffsetShell:通过重用来自其他工具的逻辑,添加对安全连接的支持真的很容易。如果这样做,请考虑向 Kafka 发送补丁 =)

  • 编写一个调用 Consumer.endOffsets() 的小工具

  • 使用kafka.tools.DumpLogSegments:作为最后的手段,这个工具也可以用来找到最后的偏移量

关于apache-kafka - 通过 CMD 在启用 SSL 的 Kafka 中获取最新的偏移量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59313030/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com