gpt4 book ai didi

apache-kafka - 为什么 kafka 无法为特定分区提交偏移量?

转载 作者:行者123 更新时间:2023-12-04 04:15:09 26 4
gpt4 key购买 nike

kafka 消费者未能仅针对特定分区提交偏移量。

aklsfoipafasldmaknfa    asiofuasofiusaofasd
[2019-01-04 12:22:22,691] ERROR [Consumer clientId=consumer-1, groupId=console-consumer-11955] Offset commit failed on partition my-topic-2-9 at offset 0: The request timed out. (org.apache.kafka.clients.consumer.internals.ConsumerCoordinator)
[2019-01-04 12:22:28,617] ERROR [Consumer clientId=consumer-1, groupId=console-consumer-11955] Offset commit failed on partition my-topic-2-9 at offset 1: The request timed out. (org.apache.kafka.clients.consumer.internals.ConsumerCoordinator)
as;lkasl;dkas;faskfasfasfasodaspd qdoiwudqouoaisdiaduasodiuasd
[2019-01-04 12:23:18,875] ERROR [Consumer clientId=consumer-1, groupId=console-consumer-11955] Offset commit failed on partition my-topic-2-9 at offset 1: The request timed out. (org.apache.kafka.clients.consumer.internals.ConsumerCoordinator)

谁能向我解释这个错误以及可能导致此错误的原因?

我们的集群有 5 个代理在 AWS 中运行。我们使用 Apache Kafka 2.1。

我正在运行一个非常简单的 Kafka-console-producer 并使用 Kafka 控制台消费者使用相同的消息。

在控制台消费者使用消息后,我看到此错误。
// PRODUCER
./bin/kafka-console-producer.sh --broker-list kafka1:9092 --topic my-topic-2 --property "parse.key=true" --property "key.separator=,"

//CONSUMER
./bin/kafka-console-consumer.sh --bootstrap-server kafka1:9092 --from-beginning --topic my-topic-2 --property="print.key=true"

请注意,我们的集群有 200 多个主题,其中包含许多生产者和消费者。

只是我无法理解这种行为。

他是grafana的截图。
enter image description here

编辑:

请随时询问更多详情。这个错误真的很令人沮丧。

编辑2:
./bin/kafka-topics.sh --describe --zookeeper zookeeper1:2181/kafka --topic my-topic-2
Topic:my-topic-2 PartitionCount:10 ReplicationFactor:3 Configs:
Topic: my-topic-2 Partition: 0 Leader: 4 Replicas: 4,2,3 Isr: 4,2,3
Topic: my-topic-2 Partition: 1 Leader: 5 Replicas: 5,3,4 Isr: 5,4,3
Topic: my-topic-2 Partition: 2 Leader: 1 Replicas: 1,4,5 Isr: 1,4,5
Topic: my-topic-2 Partition: 3 Leader: 2 Replicas: 2,5,1 Isr: 2,1,5
Topic: my-topic-2 Partition: 4 Leader: 3 Replicas: 3,1,2 Isr: 3,2,1
Topic: my-topic-2 Partition: 5 Leader: 4 Replicas: 4,3,5 Isr: 4,3,5
Topic: my-topic-2 Partition: 6 Leader: 5 Replicas: 5,4,1 Isr: 5,4,1
Topic: my-topic-2 Partition: 7 Leader: 1 Replicas: 1,5,2 Isr: 1,2,5
Topic: my-topic-2 Partition: 8 Leader: 2 Replicas: 2,1,3 Isr: 2,3,1
Topic: my-topic-2 Partition: 9 Leader: 3 Replicas: 3,2,4 Isr: 3,2,4

编辑 3:

我更想知道这个问题的可能原因,这可能有助于我们找出集群的其他问题。

编辑 4:

所有的代理、消费者和生产者都在同一个区域的同一个 VPC 中。
我知道可以增加偏移提交超时,但为什么呢?是什么导致了这种延迟?对于一个应该是实时的系统来说,5000 毫秒本身就太多了。
有可能是 kafka brokers 过载或网络拥塞,但为什么呢?如您所见,数据输入速率最大为 2-3 mbps,对于 5 台机器的 kafka 集群(r5.xlarge)来说是否太多了?告诉我是否是这种情况,我对 kafka 很陌生。
在这样的设置中,什么会成为瓶颈?

最佳答案

您的消费者线程与主题分区之间的比率是多少?

我在我的集​​群中发现,当少量消费者线程从大量分区(例如分配给 30 个主题分区的 1 个线程)消费时,更可能发生此错误。

使这个错误消失的最佳配置是 1:1(每个主题分区有 1 个消费者线程),但现在我在想向组添加更多消费者线程时遇到了缩放问题。

我通过开发一种强制执行 1:1 比率的消费者部署机制来处理它,例如,当部署 3 个消费者以消耗 30 个分区时,每个消费者将打开 10 个线程,而对于扩展,假设部署 10 个消费者,每个消费者将打开 3 个线程。 ..

我不知道我是否遵循了这里的最佳实践,但它现在可以完成工作

关于apache-kafka - 为什么 kafka 无法为特定分区提交偏移量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54039216/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com