Kafka消费者组脚本查看所有消费者组不工作

Gok*_*raj 6 apache-kafka

当我在 kafka 中执行以下命令时

./kafka-consumer-groups.sh --bootstrap-server sample-address:9092 --list
Run Code Online (Sandbox Code Playgroud)

我正面临以下错误

Error: Executing consumer group command failed due to org.apache.kafka.common.KafkaException: Failed to find brokers to send ListGroups
java.util.concurrent.ExecutionException: org.apache.kafka.common.KafkaException: Failed to find brokers to send ListGroups
    at org.apache.kafka.common.internals.KafkaFutureImpl.wrapAndThrow(KafkaFutureImpl.java:45)
    at org.apache.kafka.common.internals.KafkaFutureImpl.access$000(KafkaFutureImpl.java:32)
    at org.apache.kafka.common.internals.KafkaFutureImpl$SingleWaiter.await(KafkaFutureImpl.java:89)
    at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:262)
    at kafka.admin.ConsumerGroupCommand$ConsumerGroupService.listGroups(ConsumerGroupCommand.scala:132)
    at kafka.admin.ConsumerGroupCommand$.main(ConsumerGroupCommand.scala:58)
    at kafka.admin.ConsumerGroupCommand.main(ConsumerGroupCommand.scala)
Caused by: org.apache.kafka.common.KafkaException: Failed to find brokers to send ListGroups
    at org.apache.kafka.clients.admin.KafkaAdminClient$22.handleFailure(KafkaAdminClient.java:2610)
    at org.apache.kafka.clients.admin.KafkaAdminClient$Call.fail(KafkaAdminClient.java:614)
    at org.apache.kafka.clients.admin.KafkaAdminClient$TimeoutProcessor.handleTimeouts(KafkaAdminClient.java:730)
    at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.timeoutPendingCalls(KafkaAdminClient.java:798)
    at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.run(KafkaAdminClient.java:1092)
    at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
Run Code Online (Sandbox Code Playgroud)

Gok*_*raj 14

就我而言,我注意到我们正在使用 SSL

listeners=SSL://sample-address:9092
Run Code Online (Sandbox Code Playgroud)

所以我认为我需要在命令中传递 SSL 属性并且它有效

bin/kafka-consumer-groups.sh --bootstrap-server sample-address:9092 --list --command-config /kafka/config/client-ssl.properties
Run Code Online (Sandbox Code Playgroud)

客户端-ssl.properties

bootstrap.servers=sample-address:9092
security.protocol=SSL
ssl.truststore.location=/keys/truststore.jks
ssl.truststore.password=*****
ssl.keystore.location=/keys/keystore.jks
ssl.keystore.password=*****
Run Code Online (Sandbox Code Playgroud)


小智 2

经过大量调试后,我复制了这个场景和下面的解决方案,为我工作。

我已经在server.properties(主要负责启动kafka服务器)中进行了更改,而不是在侦听器密钥中传递“localhost” “IP地址”

详细步骤如下:-

这些是运行命令时必须确保的配置。

  1. 检查命令 bin/kafka-consumer-groups.sh --bootstrap-server 192.168.XX:4848 --list中传递的正确 IP 地址和端口组合
  2. 最重要的一点是,在 server.properties 中正确配置监听器的 IP 地址。

    听众=PLAINTEXT://**192.168.XX :4848 --工作**

    听众= PLAINTEXT://localhost:4848 --不工作

  3. 更改后,重新启动kafka服务器。

注意:- 此问题通常会在虚拟框中重现/出现。将 NAT 等网络设置更改为桥接后。