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.