我发现了一个站点,该站点演示了使用Kafka Consumer API读取所有现有消费者组的功能,并使用另一个脚本可以读取指定组的偏移量。以下脚本执行将产生以下错误:
]#./kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 --list
Note: This will not show information about old Zookeeper-based consumers.
[2018-09-22 09:00:21,043] WARN Connection to node -1 could not be
established. Broker may not be available.
(org.apache.kafka.clients.NetworkClient)
Error: Executing consumer group command failed due to Request METADATA
failed on brokers List(127.0.0.1:9092 (id: -1 rack: null))
]# ./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
Note: This will not show information about old Zookeeper-based
consumers.
[2018-09-22 09:00:39,070] WARN Connection to node -1 could not be
established. Broker may not be available.
(org.apache.kafka.clients.NetworkClient)
Error: Executing consumer group command failed due to Request METADATA
failed on brokers List(localhost:9092 (id: -1 rack: null))
]# ./kafka-consumer-groups.sh --zookeeper localhost:9092 --list
Note: This will only show information about consumers that use
ZooKeeper (not those using the Java consumer API).
[2018-09-22 09:02:30,369] WARN Session 0x0 for server null, unexpected
error, closing socket connection and attempting reconnect
(org.apache.zookeeper.ClientCnxn)
java.net.ConnectException: Connection refused
试图将引导服务器从127.0.0.1更改为zookeeper和localhost。任何人都可以找出问题所在以及如何解决吗?如果我能确定这些脚本是否有效,那么也许可以尝试从Java应用程序远程调用并执行它们。
谢谢