上海古都建筑设计集团,上海办公室装修设计公司,上海装修公司高质量的内容分享社区,上海装修公司我们不是内容生产者,我们只是上海办公室装修设计公司内容的搬运工平台

[kafka] 消费没有数据的问题解决Group coordinator lookup failed: The coordinator is not available

guduadmin11天前

[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] 消费没有数据的问题解决Group coordinator lookup failed: The coordinator is not available,第1张

 一定记得执行命令后重启kafka服务。

到此问题解决。希望对小伙伴们有帮助。

网友评论

搜索
最新文章
热门文章
热门标签