The Kafka Cluster Explained

The Kafka Cluster Explained

A beginner-friendly tour of how many Kafka servers team up to store, share, and protect your events, and what keeps the team running when something breaks.

Picture a large public library with several branches spread around a city. No single branch holds every book, yet a visitor can ask for any title and get it. If one branch closes for repairs, copies of its most important books are already waiting in other branches. A head librarian keeps a master list of which branch holds what, and a team of assistants makes sure the lists stay correct. A Kafka cluster works in exactly this way. Many servers act as one system, sharing the work and the responsibility, so that your data stays available even when some servers fail. This guide walks through every part of that system in simple words.

1Why One Server Is Never Enough

Before learning what a cluster is, let us see why a single Kafka server cannot carry a serious business.

The limits of one machine

Apache Kafka is a system for storing and moving streams of events, such as orders, payments, clicks, or sensor readings. You can run Kafka on a single computer, and that is perfectly fine for learning. But a single computer has hard limits. Its disk can only hold so much. Its network card can only carry so much traffic. Its memory and processor can only serve so many readers and writers at once.

There is a second, more serious problem. A single machine is a single point of failure. If its power supply breaks, if the operating system needs a restart, or if someone trips over a cable, everything stops. Every application that depends on it stops too.

Simple Analogy

Imagine a town with only one bakery. If the baker falls ill, the whole town has no bread. It also cannot bake more bread than one oven allows. A town with five bakeries can serve more people, and it survives when one baker takes a day off. A Kafka cluster is the town with five bakeries.

What a cluster gives you

A cluster is a group of Kafka servers that cooperate as one logical system. It gives you three gifts: more capacity because the work is divided, more speed because many machines work in parallel, and more safety because your data is copied to several machines. The rest of this guide explains how Kafka achieves each of these.

i
Helpful Note

Applications do not need to know how many servers exist. They connect to the cluster, and the cluster tells them where to find each piece of data. From the outside, it looks like one big, reliable Kafka.

2What Is a Kafka Cluster?

A Kafka cluster is a team of servers, called brokers, that together store events and serve the applications that write and read them.

The simple definition

Each Kafka server is called a broker. A cluster is simply several brokers that know about one another and share the job. Production clusters commonly have three brokers at the very least, and large companies run clusters with dozens or even hundreds of brokers. Each broker has its own disks, its own network address, and its own share of the data.

What the cluster is responsible for

The cluster accepts events from producers, which are applications that write data. It stores those events safely on disk. It delivers them to consumers, which are applications that read data. It also keeps copies of the data, decides which broker is in charge of which piece, and repairs itself when a broker disappears.

3+
Brokers in a typical production cluster
3
Copies of each piece of data in a common setup
1
Logical system seen by your applications
Simple Analogy

Think of a relay team in athletics. Each runner carries the baton for one part of the race, yet the team wins or loses as one. The brokers are the runners, the events are the baton, and the cluster is the team that must finish the race together.

3The Vocabulary of a Cluster

A handful of words describe almost everything about a cluster. Learn these and the rest becomes easy.

Term 1

Broker

One Kafka server. It stores some partitions and answers requests from producers and consumers.

Term 2

Topic

A named category of events, like “orders” or “payments”. Think of it as a labelled folder.

Term 3

Partition

A slice of a topic. Splitting a topic into partitions lets different brokers share its work.

Term 4

Replica

A copy of a partition stored on a broker. Each partition usually has several replicas on different brokers.

Term 5

Leader

The one replica of a partition that handles all reads and writes for it at a given moment.

Term 6

Follower

A replica that quietly copies the leader so it can take over if the leader is lost.

Term 7

Controller

The broker role that makes cluster-wide decisions, such as choosing a new leader after a failure.

Term 8

Replication Factor

How many copies of each partition exist in total, including the leader.

A first picture

The diagram below shows a small cluster with three brokers holding one topic that has three partitions. Notice that every partition has a leader on one broker and followers on the others.

flowchart TB
  subgraph B1["Broker 1"]
    P0L["Partition 0 - Leader"]
    P1F["Partition 1 - Follower"]
    P2F["Partition 2 - Follower"]
  end
  subgraph B2["Broker 2"]
    P1L["Partition 1 - Leader"]
    P0F["Partition 0 - Follower"]
    P2F2["Partition 2 - Follower"]
  end
  subgraph B3["Broker 3"]
    P2L["Partition 2 - Leader"]
    P0F2["Partition 0 - Follower"]
    P1F2["Partition 1 - Follower"]
  end
        
FIG 1 — A three-broker cluster with leaders spread evenly
Simple Analogy

In a school with three classrooms, each subject has one main teacher and two substitute teachers who know the same lessons. The main teacher is the leader, the substitutes are followers. Teaching duties are spread so that no single teacher carries every subject.

4How Partitions Spread the Work

Partitions are the secret to how a cluster shares its load.

Slicing a topic

When you create a topic, you choose how many partitions it has. Kafka then places these partitions across the brokers of the cluster. A topic with twelve partitions in a cluster of three brokers will typically have four partitions on each broker as leaders. Because each partition is an independent, ordered log of events, different brokers can serve different partitions at the same time without getting in each other’s way.

Why this creates speed

Suppose a producer sends ten thousand events each second. If everything went to a single partition on a single broker, that broker would carry all the load. With twelve partitions spread across three brokers, each broker carries roughly a third of the traffic. The same idea works for readers, because a group of consumers can each read different partitions in parallel.

Simple Analogy

A supermarket with one checkout counter has a long queue. A supermarket with twelve counters, staffed by several cashiers, moves people through quickly. Partitions are the counters, and brokers are the cashiers who share them.

Order inside a partition

Kafka guarantees that events inside one partition are stored and delivered in the order they were written. To keep related events together, producers attach a key, such as a customer number, and Kafka sends all events with the same key to the same partition. Order across different partitions is not guaranteed, and this is a trade-off you accept in exchange for parallel speed.

!
Common Mistake

Choosing too few partitions at the start is a popular error. The number of partitions limits how many consumers in one group can read in parallel. Adding partitions later is possible, but it changes how keys map to partitions, which can disturb ordering for existing keys.

5Replication: Keeping Copies Safe

Replication is what turns a group of machines into a reliable cluster.

Leaders and followers

Every partition has one leader replica and zero or more follower replicas, each on a different broker. All producers write to the leader, and by default consumers read from the leader as well. The followers continuously fetch new events from the leader and append them to their own copies. They are like students copying notes from the teacher’s board in real time.

The replication factor

The replication factor is the total number of copies. A factor of three is the most common in production, meaning one leader and two followers. With three copies, the cluster can lose one broker and still have complete data, and it can even survive losing two brokers without losing information, though it may stop accepting writes depending on your safety settings.

Simple Analogy

A company keeps an important contract in three places: the head office safe, a bank locker, and a lawyer’s cabinet. Even if a fire destroys one location, the contract survives. Replication factor three is that habit applied to your data.

Different brokers, always

Kafka never places two copies of the same partition on the same broker. Putting two copies on one machine would defeat the purpose, because a single failure would remove both. This is why the replication factor can never be larger than the number of brokers in the cluster.

sequenceDiagram
  participant P as Producer
  participant L as Leader Broker
  participant F1 as Follower Broker 1
  participant F2 as Follower Broker 2
  P->>L: Send event
  L->>L: Append to own log
  F1->>L: Fetch new events
  L-->>F1: Return event
  F2->>L: Fetch new events
  L-->>F2: Return event
  L-->>P: Confirm write
        
FIG 2 — Followers copy the leader, then the producer receives its confirmation
i
Helpful Note

Replication costs storage and network. Three copies mean roughly three times the disk space and extra traffic between brokers. Most teams accept this cost gladly, because the safety it buys is worth far more.

6In-Sync Replicas and Safe Writes

Not every copy is equally up to date. Kafka keeps track of which ones can be trusted.

What is an in-sync replica?

The set of replicas that are fully caught up with the leader is called the in-sync replica set, often shortened to ISR. The leader is always a member. A follower stays in the set as long as it keeps up with the leader within a limited delay. If a follower becomes slow, perhaps because its broker is overloaded or its network is weak, Kafka removes it from the set until it catches up again.

Why the set matters

When the leader fails, Kafka only promotes a new leader from the in-sync set. This guarantees that the new leader has every event that was confirmed to the producer. A follower that had fallen behind might be missing recent events, and promoting it would silently lose data.

Simple Analogy

Imagine a class where a few students copy the teacher’s notes each day. If the teacher is absent, you would choose a substitute from those who have kept their notes fully up to date, not from someone who missed last week’s lessons.

Confirmation levels for producers

Producers can choose how many copies must be safely stored before Kafka confirms a write. This gives a dial between speed and safety.

Producer ChoiceWhat Kafka Waits ForSpeedSafety
No confirmationNothing; the producer just sendsFastestLowest; events can be lost
Leader onlyThe leader has written the eventFastMedium; lost if the leader fails at once
All in-sync replicasEvery replica in the in-sync set has written itSlowerHighest; survives leader failure

The minimum in-sync setting

Clusters also have a rule for the minimum number of in-sync replicas required to accept a write. With three replicas and a minimum of two, the cluster keeps accepting writes even if one broker is down, because two copies still confirm each event. If two brokers fail, the cluster refuses new writes rather than risk keeping only one copy. This is Kafka choosing safety over availability, and it is a wise choice for important data.

!
Common Mistake

Setting the replication factor to three but the minimum in-sync count to one. This looks safe on paper, yet the cluster may accept writes when only the leader holds them. Always pair a strong confirmation level with a sensible minimum.

7The Controller: The Cluster’s Decision Maker

Someone must keep the master list and make decisions when things change. In Kafka, that job belongs to the controller.

What the controller does

The controller tracks which brokers are alive, which partitions exist, who leads each partition, and which replicas are in sync. When a broker disappears, the controller notices and chooses new leaders for every partition that lost its leader. When a new topic is created or partitions are added, the controller assigns them to brokers. It also spreads this updated information to the other brokers so everybody shares the same view.

Simple Analogy

The controller is like the head librarian who keeps the master catalogue. When one branch closes, the head librarian decides which other branch now becomes the main source for its most-borrowed books, and then informs everyone.

The older way and the newer way

In earlier years, Kafka relied on a separate coordination service called ZooKeeper to store its metadata and elect the controller. That meant running and maintaining two different systems. Modern Kafka replaces it with a built-in mechanism called KRaft, short for Kafka Raft. In KRaft mode, a small group of nodes called the controller quorum stores the cluster’s metadata inside Kafka itself, using an agreement method known as the Raft protocol. Recent major versions of Kafka have removed ZooKeeper completely, so new clusters use KRaft.

AspectOlder ZooKeeper StyleModern KRaft Style
Systems to runKafka plus a separate ZooKeeper groupKafka alone
Where metadata livesIn ZooKeeperIn an internal Kafka log
Recovery after controller lossSlower for large clustersFaster, since the standby already holds the data
Scale of partitionsMore limitedDesigned to support far more
Operational effortHigherLower

The controller quorum

A quorum means a majority vote. The controller nodes elect one active controller among themselves, and the others stay ready as standbys that hold identical copies of the metadata. A majority must agree on any change. This is why controller groups have an odd number of members, usually three or five. With three, the group tolerates one failure. With five, it tolerates two.

flowchart LR
  subgraph Q["Controller Quorum"]
    C1["Controller 1 - Active"]
    C2["Controller 2 - Standby"]
    C3["Controller 3 - Standby"]
  end
  Q --> B1["Broker 1"]
  Q --> B2["Broker 2"]
  Q --> B3["Broker 3"]
  Q --> B4["Broker 4"]
        
FIG 3 — A controller quorum guiding the brokers
i
Helpful Note

In small clusters, the same servers can play both roles, being brokers and controllers together. In larger production clusters, teams often run dedicated controller nodes so that heavy data traffic never disturbs cluster decisions.

8What Happens When a Broker Fails

The true test of a cluster is how it behaves on a bad day. Let us walk through a failure step by step.

1

A broker goes silent

Brokers send regular signals to show they are alive. When Broker 2 stops sending them, perhaps due to a crash or a network cut, the controller notices the silence.

2

The controller finds the affected partitions

It checks the master list and finds every partition whose leader lived on Broker 2. Partitions whose leaders lived elsewhere are not affected as leaders.

3

New leaders are chosen

For each affected partition, the controller promotes a follower from the in-sync set to become the new leader. Because it was fully caught up, no confirmed event is lost.

4

Everyone learns the new map

The updated leadership information spreads to all brokers. Producers and consumers refresh their view and redirect their requests to the new leaders. This usually takes only seconds.

5

The broker returns

When Broker 2 is repaired and restarted, it rejoins as a follower for its old partitions. It fetches everything it missed from the current leaders and, once caught up, rejoins the in-sync sets.

6

Leadership is rebalanced

Over time, the cluster can hand some leadership back to the returned broker, so the work is spread evenly again rather than piling up on the survivors.

flowchart TD
  A["Broker 2 stops responding"] --> B["Controller detects the failure"]
  B --> C["Find partitions led by Broker 2"]
  C --> D["Promote an in-sync follower to leader"]
  D --> E["Publish new leadership to all brokers"]
  E --> F["Clients redirect to new leaders"]
  F --> G["Broker 2 returns and catches up"]
        
FIG 4 — The automatic recovery path after a broker failure
Simple Analogy

When a bus driver falls ill, the depot manager quickly assigns a trained standby driver, updates the timetable, and tells the ticket counters. The passengers barely notice. When the original driver recovers, he returns to duty after catching up on the latest route changes.

9Choosing a New Leader: Safe versus Risky

Sometimes every in-sync copy is gone. Kafka then faces a hard choice, and understanding it prevents nasty surprises.

The dilemma

Imagine a partition with three replicas where two brokers fail in quick succession, and the third replica had fallen behind just before. There is now no in-sync replica available. Kafka can either wait for an in-sync replica to return, which keeps data safe but leaves the partition unavailable for a while, or it can promote the out-of-date replica, which restores service immediately but permanently loses the events that replica never received.

Kafka’s default stance

By default, Kafka prefers safety and waits. Allowing an out-of-date replica to become leader is called an unclean election, and it is disabled by default in modern versions. Teams enable it only for data where availability matters more than completeness, such as certain metrics or logs that can be regenerated.

Choose safety: financial events

For payments and orders, losing even one event is unacceptable. These topics should use high confirmation levels, three replicas, a sensible minimum in-sync count, and no unclean elections.

Choose availability: disposable telemetry

For high-volume metrics where a few missing points do not matter, some teams accept a lower safety setting so the system keeps flowing even under unusual failures.

“A good cluster is not one that never fails, but one that fails in a way you planned for.”

10Spreading Copies Across Racks and Zones

Having three copies helps only if they do not all sit in the same danger zone.

Failures come in groups

Machines rarely fail alone. A whole rack of servers can lose power. A network switch can cut off every machine connected to it. In the cloud, an entire availability zone, which is a separate data-centre area within a region, can experience trouble. If all three copies of a partition live in the same rack, a single rack failure removes them all.

Rack awareness

Kafka brokers can be labelled with the rack or zone they live in. With this information, Kafka places the copies of each partition in different racks whenever possible. A cluster spread over three zones with a replication factor of three will keep one copy in each zone, so even a whole zone going dark leaves two complete copies alive.

Simple Analogy

Do not store your spare house keys in the same drawer as your main keys. Give one set to a neighbour and another to a relative in a different town. Rack awareness is the habit of scattering spare keys to different places.

flowchart LR
  subgraph Z1["Zone A"]
    BA["Broker 1"]
  end
  subgraph Z2["Zone B"]
    BB["Broker 2"]
  end
  subgraph Z3["Zone C"]
    BC["Broker 3"]
  end
  BA --- BB
  BB --- BC
  BA --- BC
        
FIG 5 — One broker per zone keeps the cluster alive if a zone fails
i
Helpful Note

Spreading a cluster across zones adds a tiny delay between brokers and can add network charges in the cloud. Most teams find the extra resilience well worth it, but the trade-off should be a conscious decision.

11How Clients Find Their Way

With many brokers, how does an application know which one to talk to?

Bootstrap servers

Every producer and consumer is given a short list of broker addresses, called bootstrap servers. The application contacts one of them and asks for the cluster’s map, called metadata. The map lists all the brokers, all the topics, and which broker currently leads each partition. The application does not need the full list of brokers up front, only enough addresses to get started. Giving two or three is wise, so that the client can still start if one is down.

Talking directly to the right leader

Armed with the map, the producer sends each event straight to the broker leading the target partition. Consumers likewise fetch from the right brokers. If leadership changes after a failure, the client’s request is answered with a gentle “not the leader anymore” message, and the client refreshes its map and tries the new leader. This is why failures are mostly invisible to well-written applications.

Simple Analogy

Walking into a big shopping mall, you first look at the directory board to learn which floor has the shoe shop. You do not need to memorise every shop. If the shop moves, the board is updated and you simply check it again.

sequenceDiagram
  participant App as Application
  participant Any as Any Broker
  participant Lead as Partition Leader Broker
  App->>Any: Ask for cluster metadata
  Any-->>App: Brokers, topics, and leaders
  App->>Lead: Send or fetch events
  Lead-->>App: Response
        
FIG 6 — A client learns the map, then talks straight to the leader

12Growing and Rebalancing the Cluster

Clusters are meant to grow. Adding capacity is possible, but it needs a little thought.

Adding a new broker

When your traffic grows, you add more brokers. There is one important detail: a new broker does not automatically take over existing data. It joins the cluster empty. Only new topics and partitions may be placed on it. To make it useful for existing topics, you must move some partitions onto it, an activity known as partition reassignment.

Reassignment and its cost

During reassignment, Kafka copies the partition’s data from the old broker to the new one, then switches the replica over. This copying uses network and disk, and it can slow down normal traffic if done carelessly. Careful teams limit the copying speed, move a few partitions at a time, and choose quieter hours. Tools exist to automate the balancing of load, and many managed services do it in the background.

1

Add the new broker

Start it and let it join the cluster. It appears in the map but holds no old data yet.

2

Plan the move

Decide which partitions should shift so that every broker holds a fair share of data and traffic.

3

Copy gently

Start the reassignment with a speed limit so that ordinary producers and consumers are not squeezed.

4

Verify and clean up

Confirm that the new replicas are in sync, and that the old copies have been removed and the load looks even.

Simple Analogy

Hiring a new delivery driver does not automatically give them routes. A manager must reassign some routes from busy drivers to the newcomer. Doing it all at once in the middle of the festival rush would create chaos, so a sensible manager shifts routes gradually.

!
Common Mistake

Adding brokers and assuming the load will spread by itself. Without moving partitions, the old brokers stay busy while the new one sits idle, and you have paid for capacity you are not using.

13Sizing a Cluster: How Big Should It Be?

There is no single right size, but a few simple questions guide the decision.

Question 1

How much data per second?

Estimate the incoming volume. This decides the network and disk speed the brokers need to absorb writes.

Question 2

How long to keep it?

Retention multiplied by volume, then multiplied by the replication factor, gives the total disk space required.

Question 3

How many readers?

Every consumer group reads the data again, so outgoing traffic can be many times larger than incoming traffic.

Question 4

How much safety?

Higher safety means more copies and more brokers, so the cluster can lose some and still meet its promises.

Question 5

How much spare room?

Leave headroom for growth, busy days, and the extra work that happens during failures and rebalancing.

A worked idea in words

Suppose your applications write one hundred megabytes of events every second, and you keep them for three days with three copies. That is a very large amount of storage, several hundred terabytes, spread over the brokers. Now imagine ten different consumer groups all reading that stream. Outgoing traffic is roughly ten times the incoming traffic. Seen this way, it becomes clear that disks and networks, not processors, are usually the first limits you meet.

i
Helpful Note

Start with a modest cluster, measure the real load, and grow as evidence appears. Guessing very large numbers on the first day wastes money, and guessing tiny numbers causes emergencies. Measurement beats guessing.

14Running Several Clusters Together

One cluster is not always enough. Larger organisations often run many, and connect them.

Why more than one cluster?

A company may run separate clusters for different regions, so that European customers’ data stays in Europe and users everywhere enjoy low delay. Others keep a standby cluster in a distant location for disaster recovery, in case an entire region is lost. Some separate clusters by business area or by importance, so that a noisy experimental workload can never disturb the payments system.

Copying between clusters

Kafka provides tools, such as MirrorMaker and similar replication services, that continuously copy topics from one cluster to another. This copy is separate from the internal replication inside a cluster. It is usually slightly delayed, so after a regional disaster the standby cluster may be missing the last few seconds of events. Teams must plan for this gap and decide how applications resume in the other location.

SetupPurposeMain Trade-off
Single cluster in one regionSimplicity and low costA regional disaster stops everything
Single cluster across zonesSurvives the loss of one zoneSlight added delay and network cost
Active and standby clustersDisaster recovery in another regionStandby may lag; failover takes planning
Active and active clustersLocal speed and resilience in several regionsComplex to design; duplicate and conflicting events need care
Simple Analogy

A newspaper may have a main printing plant and a backup plant in another city. The backup receives the pages a little after the main plant does. If a flood closes the main plant, the backup can still print, though it might miss the very last edit.

15Security and Monitoring of a Cluster

A cluster carries valuable business facts, so it must be guarded and watched.

Guarding the doors

Kafka can encrypt traffic between applications and brokers, and between the brokers themselves, so that nobody listening on the network can read the events. It can require every client to prove its identity, which is called authentication. It can then apply rules about who may write to or read from each topic, which is called authorisation. Large organisations also encrypt data stored on disk and keep records of who accessed what.

Simple Analogy

Consider a bank branch. Armoured cars protect money in transit, which is encryption. The guard checks your identity at the door, which is authentication. Your key opens only your own locker, which is authorisation.

Watching the vital signs

Under-replicated
Partitions missing one or more copies
Consumer lag
How far readers are behind the newest event
Disk usage
Storage left on each broker

Good teams also watch offline partitions, which have no leader at all and are therefore unavailable. They watch request delays, network use, and the health of the controller. They set alerts so that a small trouble, like a broker falling out of sync, is fixed long before it grows into an outage. Dashboards showing these numbers over time also help to plan growth.

!
Common Mistake

Letting broker disks fill up. A broker with a full disk stops working, and the cluster loses capacity at the worst possible time. Always alert well before storage reaches its limit.

16Deployment Choices: Self-Managed or Managed

You can run a cluster yourself or let a provider do it. Each path has its own comfort and cost.

Advantages of Self-Managed

  • Full control over every setting and version
  • Can be cheaper at very large, steady scale
  • Data can stay entirely inside your own network
  • Freedom to tune hardware for your workload

Disadvantages of Self-Managed

  • Your team must handle upgrades, repairs, and night-time alerts
  • Needs deep Kafka knowledge on the team
  • Mistakes in sizing or settings become your own outages

Advantages of Managed Service

  • The provider handles servers, patches, and recovery
  • Faster to start, often within minutes
  • Easier scaling up and down
  • Teams focus on building products, not running clusters

Disadvantages of Managed Service

  • Ongoing fees that grow with usage
  • Less freedom to change deep settings
  • Some dependence on the provider’s limits and features

Many teams also run Kafka on container platforms such as Kubernetes, using specialised operators that automate much of the routine work. This offers a middle path, but it still requires a team that understands both Kafka and the platform underneath it.

17Anti-Patterns and Best Practices

Learning from common errors is the cheapest education there is.

ANTI-PATTERN-01 Avoid
Problem

Running a production cluster with only one or two brokers, or with a replication factor of one.

Why It’s Harmful

Any single failure can make data unavailable or permanently lost. There is no safe way to do maintenance either.

Correct Approach

Use at least three brokers and a replication factor of three for important topics, spread across separate racks or zones.

ANTI-PATTERN-02 Avoid
Problem

Ignoring uneven load, where a few brokers lead most of the busy partitions while others stay quiet.

Why It’s Harmful

The overloaded brokers become slow and are more likely to fail, and their failure pushes even more load onto the rest.

Correct Approach

Watch the spread of partitions and leaders, rebalance regularly, and choose keys that avoid one very popular key overwhelming a single partition.

ANTI-PATTERN-03 Avoid
Problem

Upgrading every broker at the same time, or restarting several brokers together, to save effort.

Why It’s Harmful

Multiple brokers going down together can leave partitions without enough in-sync copies, and the cluster stops accepting writes.

Correct Approach

Perform rolling upgrades: one broker at a time, waiting until it has rejoined and caught up before touching the next.

Best practices at a glance

Habit 1

Odd-sized controller group

Use three or five controller nodes so that a clear majority can always be formed.

Habit 2

Spread across zones

Label brokers by rack or zone so copies never share the same fate.

Habit 3

Pair safe settings

Combine three replicas, full confirmation, and a minimum of two in-sync copies for important data.

Habit 4

Rehearse failure

Practise stopping a broker in a test environment and confirm that applications recover cleanly.

Habit 5

Alert early

Warn on lag, missing copies, and disk usage long before customers feel anything.

Habit 6

Upgrade one at a time

Roll changes through the cluster gently, checking health at each step.

18Frequently Asked Questions

Q1What is the minimum number of brokers for production?

Three is the usual starting point. It allows three copies of each partition on different machines and lets the cluster survive the loss of one broker while still accepting safe writes.

Q2Can the replication factor be higher than the number of brokers?

No. Each copy of a partition must live on a different broker, so you cannot have more copies than brokers.

Q3Do all brokers hold all the data?

No. Each broker holds a share of the partitions. Only through replication does a piece of data live on several brokers, and even then not on all of them unless the cluster is very small.

Q4Do I still need ZooKeeper?

New clusters use KRaft, where the cluster stores its own metadata. Recent major Kafka versions have removed ZooKeeper support, so older clusters must migrate before upgrading past the last version that supports it.

Q5What happens if the controller fails?

Another member of the controller quorum takes over, because all standbys hold the same metadata. This usually happens within moments, and data traffic keeps flowing in the meantime.

Q6Is data lost when a broker crashes?

Not if the data was confirmed with sensible safety settings. Confirmed events exist on several in-sync replicas, so a follower with the complete data becomes the new leader.

Q7Does adding a broker instantly increase performance?

Not by itself. The new broker starts empty. You must move partitions onto it before it shares the existing load.

Q8How is copying between clusters different from replication inside a cluster?

Inside a cluster, replication keeps followers in step with leaders and is part of the write confirmation. Copying between clusters is a separate tool that mirrors topics to another location, usually with a small delay, mainly for disaster recovery or regional access.

Q9Should every topic use the same settings?

No. Choose settings per topic based on how valuable the data is. Critical business events deserve the strongest safety, while throwaway telemetry can accept lighter settings for speed.

19Summary and Key Takeaways

We began with a city library whose branches share books and back one another up. A Kafka cluster is that same idea for events. Several brokers divide topics into partitions, keep replicated copies on different machines, and elect leaders to handle traffic. A controller, backed by a quorum in modern KRaft mode, keeps the master map and reacts when brokers fail. Clients simply learn the map and talk to the right leaders. By spreading copies across racks and zones, tuning safety settings, growing carefully, and watching a few key signals, a cluster can lose machines without losing data or trust. The cluster is not magic; it is a well-organised team with clear roles and plans for bad days.

Key Takeaways

  • A cluster is a team of brokers — they share storage and traffic so that no single machine is a limit or a single point of failure.
  • Partitions spread the work — topics are sliced so many brokers and many consumers operate in parallel, with order kept inside each partition.
  • Replication protects data — each partition has a leader and followers on different brokers, usually three copies in total.
  • In-sync replicas decide safety — only fully caught-up copies can become leaders, and settings like full confirmation and a minimum in-sync count prevent silent loss.
  • The controller keeps order — in KRaft mode a quorum of controller nodes stores metadata and elects new leaders quickly after failures.
  • Placement matters — rack and zone awareness make sure copies do not share the same fate.
  • Operate with care — grow by moving partitions gradually, upgrade one broker at a time, and alert on lag, missing copies, and disk usage.