赞
踩
[kafka] 消费没有数据的问题解决Group coordinator lookup failed: The coordinator is not available
目录
在项目中使用了kafka,生产者可以正常的往里放数据,但是消费者无法获取数据,通过kafka命令获取也无法获取,观察控制台发现,报了如下错误。
- DEBUG org.apache.kafka.clients.Metadata - Updated cluster metadata version 133 to Cluster(id = YFJdX6kITzuEPD3F4zdZEw, nodes = [master:9092 (id: 39 rack: null)], partitions = [Partition(topic = fuxi_test, partition = 0, leader = 39, replicas = [39], isr = [39], offlineReplicas = [])], controller = master:9092 (id: 39 rack: null))
- [ForkJoinPool-1-worker-5] DEBUG o.a.k.c.consumer.internals.AbstractCoordinator - [Consumer clientId=consumer-1, groupId=test_consumer] Sending FindCoordinator request to broker master:9092 (id: 39 rack: null)
- [ForkJoinPool-1-worker-5] DEBUG o.a.k.c.consumer.internals.AbstractCoordinator - [Consumer clientId=consumer-1, groupId=test_consumer] Received FindCoordinator response ClientResponse(receivedTimeMs=1590026706655, latencyMs=4, disconnected=false, requestHeader=RequestHeader(apiKey=FIND_COORDINATOR, apiVersion=2, clientId=consumer-1, correlationId=265), responseBody=FindCoordinatorResponse(throttleTimeMs=0, errorMessage='null', error=COORDINATOR_NOT_AVAILABLE, node=:-1 (id: -1 rack: null)))
- [ForkJoinPool-1-worker-5] DEBUG o.a.k.c.consumer.internals.AbstractCoordinator - [Consumer clientId=consumer-1, groupId=test_consumer] Group coordinator lookup failed: The coordinator is not available.
- [ForkJoinPool-1-worker-5] DEBUG o.a.k.c.consumer.internals.AbstractCoordinator - [Consumer clientId=consumer-1, groupId=test_consumer] Coordinator discovery failed, refreshing metadata
排查发现topic中没有__consumer_offsets,必须有他才可以正常获取到值,创建命令如下,创建后重启kafka服务和zookeeper服务,就可以正常获取到数据了。
kafka-topics --zookeeper 127.0.0.1:2181 --partitions 1 --replication-factor 1 --create --topic __consumer_offsets
kafka-topics.bat在kafka/bin/windows下
一定记得执行命令后重启kafka服务。
到此问题解决。希望对小伙伴们有帮助。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。