当生产者在 Kafka 中提出 NotEnoughReplicas
When producer raise NotEnoughReplicas in Kafka
Kafka 文档 min.insync.replicas 说:
When a producer sets acks to "all" (or "-1"), min.insync.replicas specifies the minimum number of replicas that must acknowledge a write for the write to be considered successful. If this minimum cannot be met, then the producer will raise an exception (either NotEnoughReplicas or NotEnoughReplicasAfterAppend).
When used together, min.insync.replicas and acks allow you to enforce greater durability guarantees. A typical scenario would be to create a topic with a replication factor of 3, set min.insync.replicas to 2, and produce with acks of "all". This will ensure that the producer raises an exception if a majority of replicas do not receive a write.
但据我了解,Producer 何时会引发 NotEnoughReplicas
异常尚不清楚。
我的两个问题:
当ISR队列数小于该值且aks=all时,Producer是立即抛出异常,还是等待超时?
当Producer收到这个error时,如果retries没有达到最大值也能重试吗?
当请求被发送到领导代理时,它将写入其领导分区,然后跟随代理将复制该消息。然后,追随者必须确认消息写入。
整个过程(包括复制)必须在 request.timeout.ms
参数配置的生产者超时内完成,并且此 request.timeout.ms
必须 大于 replica.lag.time.max.ms
(broker config, leader 从 ISR 中移除一个 broker 的时间).
如果在消息附加到日志后从 ISR 中删除了跟随者代理,那么您会得到 NotEnoughReplicasAfterAppendException
。如果它在附加到日志之前,那么你会得到 NotEnoughReplicasException
。无论哪种情况,都会重试直到 delivery.timeout.ms
.
如果您的 request.timeout.ms
在从 ISR 中的所有副本获得确认之前已经过去,那么它会重试直到达到最大重试次数或 delivery.timeout.ms
已经过去。
Does the Producer raise the exception immediately when the number of
ISR queues is less than that value and aks=all, or does it wait for a
timeout?
存在超时 (request.timeout.ms
) 等待确认。
When the Producer receives this error, it is also able to retry if the
retries does not reach the maximum value?
重试,NotEnoughReplicasAfterAppendException
和 NotEnoughReplicasException
都是 RetriableException
s。
Kafka 文档 min.insync.replicas 说:
When a producer sets acks to "all" (or "-1"), min.insync.replicas specifies the minimum number of replicas that must acknowledge a write for the write to be considered successful. If this minimum cannot be met, then the producer will raise an exception (either NotEnoughReplicas or NotEnoughReplicasAfterAppend). When used together, min.insync.replicas and acks allow you to enforce greater durability guarantees. A typical scenario would be to create a topic with a replication factor of 3, set min.insync.replicas to 2, and produce with acks of "all". This will ensure that the producer raises an exception if a majority of replicas do not receive a write.
但据我了解,Producer 何时会引发 NotEnoughReplicas
异常尚不清楚。
我的两个问题:
当ISR队列数小于该值且aks=all时,Producer是立即抛出异常,还是等待超时?
当Producer收到这个error时,如果retries没有达到最大值也能重试吗?
当请求被发送到领导代理时,它将写入其领导分区,然后跟随代理将复制该消息。然后,追随者必须确认消息写入。
整个过程(包括复制)必须在 request.timeout.ms
参数配置的生产者超时内完成,并且此 request.timeout.ms
必须 大于 replica.lag.time.max.ms
(broker config, leader 从 ISR 中移除一个 broker 的时间).
如果在消息附加到日志后从 ISR 中删除了跟随者代理,那么您会得到 NotEnoughReplicasAfterAppendException
。如果它在附加到日志之前,那么你会得到 NotEnoughReplicasException
。无论哪种情况,都会重试直到 delivery.timeout.ms
.
如果您的 request.timeout.ms
在从 ISR 中的所有副本获得确认之前已经过去,那么它会重试直到达到最大重试次数或 delivery.timeout.ms
已经过去。
Does the Producer raise the exception immediately when the number of ISR queues is less than that value and aks=all, or does it wait for a timeout?
存在超时 (request.timeout.ms
) 等待确认。
When the Producer receives this error, it is also able to retry if the retries does not reach the maximum value?
重试,NotEnoughReplicasAfterAppendException
和 NotEnoughReplicasException
都是 RetriableException
s。