2

I'm trying to understand the broker config - min.insync.replicas and here is my question.

Question 1 : If i set my replication.factor = 2 and min.insync.replicas =2, how many copies would i have for my message?

Question 2: Can i set replication.factor = 2 and min.insync.replicas =2?

0

2 Answers 2

4

Question 1 : If i set my replication.factor = 2 and min.insync.replicas = 2, how many copies would i have for my message?

The copies (replicas) of the data within a topic are dependent on the configuration replication.factor. If you set it to 2, you will have 2 copies.

Question 2: Can i set replication.factor = 2 and min.insync.replicas = 2?

Yes, you can set both values to 2. The min.insync.replicas should be less or equal to the replication.factor. However, the min.insync.replicas configuration plays a more important role when producing data to the topic. When a producer sets acks to "all" (or "-1"), this configuration 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).

The full details of those configuration are given in the section Topic-Level Configs of the Kafka docs.

3
  • thanks for the response mike, As per apache kafka doc, by definition of replication factor, it includes leader. Now my question, does in-sync replicas also include the leader?
    – Raj
    Commented May 8, 2020 at 22:10
  • Yes, it is the total number including leader. Commented May 9, 2020 at 4:24
  • The minimum allowed value for the min.insync.replicas is 1, which refers to the leader Commented May 9, 2020 at 4:39
0

Yes, we can very well do that. Infact ISR <= RF. Here ISR referes to In-sync replicas and RF refers to the Replication Factor.

Not the answer you're looking for? Browse other questions tagged or ask your own question.