简体   繁体   English

Kafka Connect 分布式模式组协调器不可用

[英]Kafka Connect Distributed mode The group coordinator is not available

I have been trying this for two weeks now, I am running Kafka cluster on separate machines than my connect nodes.我已经尝试了两周了,我在与连接节点不同的机器上运行 Kafka 集群。 I am unable to get connect running properly.我无法正常连接。 I can read and write to kafka no issue.我可以毫无问题地读写kafka。 Zookeeper seems to be running fine. Zookeeper 似乎运行良好。

I launch connect:我启动连接:

$ bin/connect-distributed connect-distributed.properties

Connect keeps looping through this error: Connect 不断循环遍历此错误:

[2018-08-21 15:45:12,161] INFO [Worker clientId=c1, groupId=connect-cluster] Discovered group coordinator 172.25.1.2:9092 (id: 2147483645 rack: null) (org.apache.kafka.clients.consumer.internals.AbstractCoordinator:677)
[2018-08-21 15:45:12,163] INFO [Worker clientId=c1, groupId=connect-cluster] (Re-)joining group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator:509)
[2018-08-21 15:45:12,165] INFO [Worker clientId=c1, groupId=connect-cluster] Group coordinator 172.25.1.2:9092 (id: 2147483645 rack: null) is unavailable or invalid, will attempt rediscovery (org.apache.kafka.clients.consumer.internals.AbstractCoordinator:729)
[2018-08-21 15:45:12,266] INFO [Worker clientId=c1, groupId=connect-cluster] Discovered group coordinator 172.25.40.219:9092 (id: 2147483645 rack: null) (org.apache.kafka.clients.consumer.internals.AbstractCoordinator:677)
[2018-08-21 15:45:12,267] INFO [Worker clientId=c1, groupId=connect-cluster] Group coordinator 172.25.1.2:9092 (id: 2147483645 rack: null) is unavailable or invalid, will attempt rediscovery (org.apache.kafka.clients.consumer.internals.AbstractCoordinator:729)

Here is what my connect-distributed.properties looks like:这是我的 connect-distributed.properties 的样子:

bootstrap.servers=172.25.1.2:9092,172.25.1.3:9092,172.25.1.4:9092
group.id=connect-cluster

key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
key.converter.schemas.enable=false
value.converter.schemas.enable=false

offset.storage.topic=connect-offsets
offset.storage.replication.factor=3
offset.storage.partitions=3

config.storage.topic=connect-configs
config.storage.replication.factor=3

status.storage.topic=connect-status
status.storage.replication.factor=3
status.storage.partitions=3

offset.flush.interval.ms=10000

rest.host.name=172.25.1.5
rest.port=8083

heartbeat.interval.ms=3000
session.timeout.ms=30000
security.protocol=PLAINTEXT
client.id=c1

plugin.path=/usr/share/java

__Consumer_offsets topic looks like this: __Consumer_offsets 主题如下所示:

/opt/kafka/bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic __consumer_offsets                                       
Topic:__consumer_offsets        PartitionCount:50       ReplicationFactor:3     Configs:segment.bytes=104857600,cleanup.policy=compact,compression.type=producer
    Topic: __consumer_offsets       Partition: 0    Leader: 2       Replicas: 1,2,3 Isr: 3,2
    Topic: __consumer_offsets       Partition: 1    Leader: 2       Replicas: 1,2,3 Isr: 3,2
    Topic: __consumer_offsets       Partition: 2    Leader: 2       Replicas: 1,2,3 Isr: 3,2
    Topic: __consumer_offsets       Partition: 3    Leader: 1       Replicas: 1     Isr: 1
    Topic: __consumer_offsets       Partition: 4    Leader: 2       Replicas: 2     Isr: 2.... etc

After writing a connector in Go, I came across the same issue.在 Go 中编写连接器后,我遇到了同样的问题。 I was forced to solve it myself.我是被迫自己解决的。

When a connector connects to kafka it automatically writes to the topics and to __offset_topics .当连接器连接到 kafka 时,它会自动写入主题和__offset_topics When a connector crashes, it leaves trace of itself in those tables as the coordinator.当连接器崩溃时,它会在这些表中作为协调器留下自己的痕迹。 When a new connector starts up it finds the record in the table and attempts to communicate with the coordinator.当新的连接器启动时,它会在表中找到记录并尝试与协调器通信。 The coordinator fails to respond and the connector never works.协调器无法响应并且连接器永远不会工作。

You can fix this one of two ways, Delete all the topics ( connect-configs , connect-offsets , connect-status , __offset_topics ) and restart the cluster.您可以通过以下两种方式之一修复此问题:删除所有主题( connect-configsconnect-offsetsconnect-status__offset_topics )并重新启动集群。 The other method is to remove the coordinator from the topics, which I am currently unsure how to perform.另一种方法是从主题中删除协调器,我目前不确定如何执行。

Posting for others who might find it useful.发布给可能会发现它有用的其他人。

I had the same problem... and restarting kafka solved the problem in my case.我遇到了同样的问题……在我的情况下,重新启动 kafka 解决了这个问题。

After executing:执行后:

service kafka status

Made my log to be fine in less than 10 seconds:使我的日志在不到 10 秒的时间内正常运行:

2019-11-08 14:30:19.781  INFO [-,,,] 1 --- [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] o.a.k.c.c.internals.AbstractCoordinator  : [Consumer clientId=consumer-2, groupId=datasources-ca-contacts] Discovered group coordinator myserver:9092 (id: 2147483647 rack: null)

I think the cause that mention @ldrrp is correct, but if you don't want or you can't delete the "offsets cache" you can use a new group for your consumer.我认为提到@ldrrp 的原因是正确的,但是如果您不想要或无法删除“偏移缓存”,您可以为您的消费者使用一个新组。

//before: original group cause error
props.put("group.id", "my_data_consumer");

//after: works for me
props.put("group.id", "my_data_consumer_2");

Deleting the broker and restarting kafka did the work for me.删除代理并重新启动 kafka 为我完成了工作。 Delete the kakfka-logs and zookeeper folder from /tmp folder in mac.从 mac 中的/tmp文件夹中删除 kakfka-logs 和 zookeeper 文件夹。

I got this error when I ran out of disk space on my brokers.当我的代理上的磁盘空间不足时,我收到了这个错误。 Might be something worth checking.可能是值得检查的东西。

将所有 kafka 代理的主机名添加到您的 /etc/hosts 文件中,然后重试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM