We have learnt that a producer can write messages to a topic partition and the messages are declared committed as long as all the in-sync replicas receive and write the message (as per Kafka reliability guarantees). However, if there’s only one in-sync replica (the leader), data loss and inconsistency can occur if the only in-sync replica goes down and is replaced by an out of sync replica as the new leader. We can protect from such a situation by configuring the parameter min.insync.replicas, which sets the minimum number of replicas to be in-sync before a message can be processed. Say, if we have 3 replicas and the parameter min.insync.replicas is set to 2, then a producer attempting to write a message to the topic will be met with NotEnoughReplicasException exception in case two out of the three replicas are down. In this situation, the single in-sync replica becomes read-only and continues to serve consumers.