当前位置:   article > 正文

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

group coordinator lookup failed: the coordinator is not available.

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

目录

前言

一、解决问题


前言

在项目中使用了kafka,生产者可以正常的往里放数据,但是消费者无法获取数据,通过kafka命令获取也无法获取,观察控制台发现,报了如下错误。

  1. 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))
  2. [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)
  3. [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)))
  4. [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.
  5. [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服务。

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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/秋刀鱼在做梦/article/detail/773515
推荐阅读
相关标签
  

闽ICP备14008679号