Docsity

Replication Factor in Apache Kafka, Summaries of Law

Partial preview of the text

Download Replication Factor in Apache Kafka and more Summaries Law in PDF only on Docsity!

Replication Factor

in Kafka

Rana khaled zian 20191485971

apache Kafka uses the concept of data replication to ensure high availability of data at all times via the Replication Factor Kafka. It supports data replication at the partition level, as it stores all data events in the form of topic-based partitions, and hence makes use of the topic partition’s write-ahead log to place partition copies across different brokers.

What is Kafka Replication

Factor?

Kafka Replication Factor refers to the multiple copies of data stored across several Kafka brokers. Setting the Kafka Replication Factor allows Kafka to provide high availability of data and prevent data loss if the broker goes down or cannot handle the request. To ensure data security it is always recommended that the Kafka Replication Factor value should be more than 1. This indicates that at least one replica of the file is present in another broker and can be accessed by you in the event of a server failure. You will notice that replication is achievable in Kafka at the partition granularity level. Applying a specialized partition ahead log, Apache Kafka effectively ensures that multiple copies of the data exist in different brokers according to the mentioned Kafka Replication Factor. Eventually, you will need to extract all of this data from Kafka to your desired destination for further analysis. Manually consolidating data from Kafka Clusters and all your sources can be a time-consuming and resource-intensive job.

As discussed above, Apache Kafka is built on the concept of Leader-Follower to provide high data availability in all cases. For instance, you can consider that you have a cluster consisting of 3 brokers namely Broker 1, Broker 2 & Broker 3. A Topic-X is created with partition 1 and partition 0. If you set up the Kafka Replication Factor as 2 , then you find that now Partition 0 has a replica in Broker 1 & 2 and Partition 1 has a replica in Broker 2 & 3. Kafka chooses one partition as a leader and the rest of the replicas are selected as the followers.