简体   繁体   English

是否可以减少 min.insync.replicas?

[英]Is it possible to decrease min.insync.replicas?

I'm planning to run a Kafka cluster in a production environment.我计划在生产环境中运行 Kafka 集群。 Before deploying the cluster, I try to find the best configuration to ensure HA and data consistency.在部署集群之前,我会尝试寻找最佳的配置来保证 HA 和数据的一致性。

I read in the official doc that it is not possible to reduce the partition replication factor, but what about the min.insync.replicas ?我在官方文档中读到不可能降低分区复制因子,但是min.insync.replicas呢? When I decrease the value on a test environment I don't see any differences when I look at topics description.当我在测试环境中降低值时,我在查看主题描述时看不到任何差异。 After changing the value from 3 to 2, I still have 3 ISR.将值从 3 更改为 2 后,我仍然有 3 个 ISR。 Is it because it's a min value or because the configuration change is not taken into account?是因为它是最小值还是因为没有考虑到配置更改?

Yes, it is possible to reduce (or in general change) the min.insync.replicas configuration of a topic.是的,可以减少(或一般更改)主题的min.insync.replicas配置。

However, as you were looking for the best configuration to ensure high availablity and data consistency, it would be counter-intuitive to reduce the value.但是,当您正在寻找最佳配置以确保高可用性和数据一致性时,降低该值将是违反直觉的。

There is a big difference between ISR (in sync replicas) and the setting min.insync.replicas . ISR(同步副本)和设置min.insync.replicas之间存在很大差异。 The ISR shown in the kafka-topics --describe just tells you how healthy the data in your topic is and if all the replicas keep up with the partitions leader. kafka-topics --describe中显示的 ISR 只是告诉您主题中的数据有多健康,以及所有副本是否跟上分区领导者的步伐。

On the other hand, the min.insync.replicas works together with a KafkaProducer writing to the topic with that setting.另一方面, min.insync.replicas与 KafkaProducer 一起使用该设置写入主题。 It is described on the official Kafka docs on TopicConfigs as:它在TopicConfigs上的官方 Kafka 文档中被描述为:

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 .当生产者将acks设置为“all”(或“-1”)时, min.insync.replicas指定必须确认写入才能被视为成功的最小副本数。

To emphasize again, if you are looking for high availabilty and consistency it is best to set acks = all in your producer while at the same time keeping the min.insync.replicas high.再次强调,如果您正在寻找高可用性和一致性,最好在您的生产者中设置acks = all ,同时保持min.insync.replicas高。

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

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