kafka启用SASL认证后使用kafka-consumer-groups.sh查看消费组报错的问题

解决SASL认证类型kafka在使用kafka-consumer-groups.sh查看消费组数据时,报以下异常的问题

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:262)
	at kafka.admin.ConsumerGroupCommand$ConsumerGroupService.collectGroupOffsets(ConsumerGroupCommand.scala:332)
	at kafka.admin.ConsumerGroupCommand$ConsumerGroupService.describeGroup(ConsumerGroupCommand.scala:252)
	at kafka.admin.ConsumerGroupCommand$.main(ConsumerGroupCommand.scala:60)
	at kafka.admin.ConsumerGroupCommand.main(ConsumerGroupCommand.scala)
Caused by: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.

解决方案:

进入docker容器,非docker部署进入kafka安装地址即可:

进入容器 docker exec -it kafka容器ID bash

进入kafka的配置config文件夹:

cd   /home/zk/kafka_2.11-2.1.1/config

执行命令:

vi consumer-group-ssl.properties

输入内容并保存:

security.protocol=SASL_PLAINTEXT
sasl.mechanism=SCRAM-SHA-512
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="账号" password="密码";

如图:

 保存配置文件consumer-group-ssl.properties

接着执行命令:

cd   /home/zk/kafka_2.11-2.1.1
./bin/kafka-consumer-groups.sh  --describe --bootstrap-server kafka的IP:kafka的端口--command-config config/consumer-group-ssl.properties --group test-group

 查询消费组数据成功!

你可能感兴趣的:(java,kafka,kafka,java,大数据)