Having learnt about rebalancing, let’s learn about another important, topic replication, in the next video.
In the previous video, you learnt about topic replication. It is extremely crucial in a distributed system. By replicating topics across different brokers, Kafka ensures fault tolerance. A topic can be replicated by specifying the replication factor while creating that topic. One issue that might arise because of replication is that of syncing of the messages across replicated partitions. This issue is taken care of by electing a leader that takes all the reads and writes and then imitates them in all the copies. Whenever a leader goes down, a zookeeper elects a new leader. All the partitions that are running in the brokers compete for leadership. The replication factor for a topic cannot be greater than the number of brokers present in the cluster.
Additional Reading
Topic Replication: You can refer to this link to learn, in detail, how to create topics with a replication factor.
Replication Factor: You can refer to this link to learn about the values that a replication factor can take.