gpt4 book ai didi

apache-kafka - Kafka - 故障排除.NotEnoughReplicasException

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

我开始看到以下错误

[2020-06-12 20:09:01,324] ERROR [ReplicaManager broker=3] Error processing append operation on partition __consumer_offsets-10 (kafka.server.ReplicaManager)
org.apache.kafka.common.errors.NotEnoughReplicasException: The size of the current ISR Set(3) is insufficient to satisfy the min.isr requirement of 2 for partition __consumer_offsets-10

My setup is having three brokers and all brokers are up. Couple of things i did before this error was about pop up

I configured min.isr to be 2 in all the brokers. I created a topic with replication factor 3 and starting producing the message from a producer with ack = 1 with two brokers down. I brought up all the brokers and started consumer.

  1. 如何解决此错误
  2. 消费者也无法看到此消息(不知道为什么,消息应该被视为“已提交”,因为在生产者运行时有一个代理已启动)

几个事实

有趣的是,尚未看到再平衡没有发生 WRT 首选领导者战略

$ kafka-topics --zookeeper 127.0.0.1:2181 --topic stock-prices --describe                             
Topic: stock-prices PartitionCount: 3 ReplicationFactor: 3 Configs: min.insync.replicas=2
Topic: stock-prices Partition: 0 Leader: 1 Replicas: 1,3,2 Isr: 1,2,3
Topic: stock-prices Partition: 1 Leader: 1 Replicas: 2,1,3 Isr: 1,2,3
Topic: stock-prices Partition: 2 Leader: 1 Replicas: 3,2,1 Isr: 1,2,3

最佳答案

这是你的问题:

您已设置 min.insync.replicas=2,这意味着您至少需要启动并运行两个代理才能向主题发布消息。如果你让 2 个经纪人失望,那么你就只剩下一个了。这意味着您的 insync.replica 要求没有得到满足。

这与消费者无关,因为这是关于经纪人的。当您设置 acks=1 时,这意味着您的生产者会在消息发布到一个代理时获得确认。 (它不会确认所有副本都已创建)。

所以问题是,当单个代理(领导者)收到消息时,您有生产者确认收到了消息。但是领导者不能放置副本,因为没有任何代理要同步。

完成此操作的一种方法是设置 acks=all,这样您的生产者在所有副本完成之前不会得到确认。它将重试,直到至少 2 个同步副本在线。

关于apache-kafka - Kafka - 故障排除.NotEnoughReplicasException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62346727/

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