kafka使用 SASL/SCRAM 认证,kafka-consumer-groups.sh 命令执行失败

夏至 发表于: 2021-12-07   最后更新时间: 2021-12-07 17:49:08   2,107 游览
/kafka-consumer-groups.sh --bootstrap-server kafka1:9092 --list

[2021-06-23 13:56:51,783] WARN The configuration 'KafkaServer' was supplied but isn't a known config. (org.apache.kafka.clients.admin.AdminClientConfig)
[2021-06-23 13:56:51,784] WARN The configuration 'password' was supplied but isn't a known config. (org.apache.kafka.clients.admin.AdminClientConfig)
[2021-06-23 13:56:51,784] WARN The configuration 'org.apache.kafka.common.security.scram.ScramLoginModule' was supplied but isn't a known config. (org.apache.kafka.clients.admin.AdminClientConfig)
[2021-06-23 13:56:51,784] WARN The configuration '};' was supplied but isn't a known config. (org.apache.kafka.clients.admin.AdminClientConfig)
[2021-06-23 13:56:51,784] WARN The configuration 'username' was supplied but isn't a known config. (org.apache.kafka.clients.admin.AdminClientConfig)
Error: Executing consumer group command failed due to org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
    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:260)
    at kafka.admin.ConsumerGroupCommand$ConsumerGroupService.collectGroupOffsets(ConsumerGroupCommand.scala:331)
    at kafka.admin.ConsumerGroupCommand$ConsumerGroupService.describeGroup(ConsumerGroupCommand.scala:251)
    at kafka.admin.ConsumerGroupCommand$.main(ConsumerGroupCommand.scala:59)
    at kafka.admin.ConsumerGroupCommand.main(ConsumerGroupCommand.scala)
Caused by: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
发表于 2021-12-07
添加评论

运行方式参考:kafka实战SASL/SCRAM

但是我觉得你应该也解决一下超时的问题,可参考:https://www.orchome.com/579

夏至 -> 半兽人 2年前

大佬,我多口ip没问题,可正常创建用户,生成证书,给予权限,准确依据权限正确生成和消费,但我想执行

bin/kafka-consumer-groups.sh --bootstrap-server kafka1:9092 --list

的命令时就报错,我也尝试给kafka-consumer-groups.sh 文件添加内容

-Djava.security.auth.login.config=/etc/kafka/kafka_client_jaas.conf

kafka_client_jaas.conf内容为(admin为超级用户)
KafkaClient {
    org.apache.kafka.common.security.scram.ScramLoginModule required
    username="admin"
    password="admin";
};

但依旧不行。

请大佬指教一下。

夏至 -> 半兽人 2年前

超时原因会不会因为执行kafka-consumer-group.sh时,无法认证造成的啊?

半兽人 -> 夏至 2年前

不会,认证错误会直接返回的。

夏至 -> 半兽人 2年前

kafka使用 SASL/SCRAM 认证
kafka-consumer-groups.sh没做如何配置的情况下,报的错

[root@node0 bin]# ./kafka-consumer-groups.sh --bootstrap-server node0:9092 --list
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:260)
    at kafka.admin.ConsumerGroupCommand$ConsumerGroupService.listGroups(ConsumerGroupCommand.scala:131)
    at kafka.admin.ConsumerGroupCommand$.main(ConsumerGroupCommand.scala:57)
    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:2615)
    at org.apache.kafka.clients.admin.KafkaAdminClient$Call.fail(KafkaAdminClient.java:620)
    at org.apache.kafka.clients.admin.KafkaAdminClient$TimeoutProcessor.handleTimeouts(KafkaAdminClient.java:736)
    at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.timeoutPendingCalls(KafkaAdminClient.java:804)
    at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.run(KafkaAdminClient.java:1098)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
半兽人 -> 夏至 2年前

你 telnet下node0 9092看看端口是否ok。

你的答案

查看kafka相关的其他问题或提一个您自己的问题