AdvancedAbout 22 min

    Kafka Replication & Leader Election

    Read the full article on Substack

    6 min read.

    Production Kafka fault tolerance: replicate a partition across brokers, commit with acks=all, and watch the controller elect a new leader from the ISR when a broker crashes.

    Think of it this way: A replicated partition is like a document with one author (the leader) and proofreaders (followers) keeping live copies. If the author quits, a proofreader who has every page so far takes over — nothing already published is lost.

    Broker 1

    Leader
    empty
    LEO 0

    Broker 2

    Follower
    empty
    LEO 0

    Broker 3

    Follower
    empty
    LEO 0

    committed up to offset none, in sync 3 of 3

    One partition on three brokers. Broker 1 is the leader. Amber records are not committed yet; green ones are.

    1/5

    Check your understanding

    Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.

    A write with acks=all

    Sequence

    Order what happens between send and acknowledgement.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    1. 1Drop a step here
    2. 2Drop a step here
    3. 3Drop a step here
    4. 4Drop a step here
    5. 5Drop a step here
    5 pieces left to place

    Quiz

    23 questions
    Question 1 of 23
    Score: 0

    Under acks=all, when is a produced record considered committed?

    Done with this lesson?

    Sign in free to keep your progress, streak and quiz scores.

    Keep going