[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服务。文章来源:https://www.toymoban.com/news/detail-733743.html
到此问题解决。希望对小伙伴们有帮助。文章来源地址https://www.toymoban.com/news/detail-733743.html
到了这里,关于[kafka] 消费没有数据的问题解决Group coordinator lookup failed: The coordinator is not available的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!