Bird
Raised Fist0
Kafkadevops~5 mins

Active-passive vs active-active in Kafka - CLI Comparison

Choose your learning style10 modes available
Introduction
When running systems that need to be always available, you can set them up so only one server works at a time (active-passive) or so multiple servers work together at the same time (active-active). This helps keep your data safe and your service running without interruptions.
When you want a simple backup server that takes over only if the main server fails.
When you need to balance the load by having multiple servers handle requests simultaneously.
When you want to avoid downtime during maintenance by having all servers active.
When you want to reduce the risk of data loss by replicating data across active servers.
When you want to improve performance by distributing work across several servers.
Commands
Create a Kafka topic with 3 partitions and replication factor 2 to support active-active setup with data replicated across brokers.
Terminal
kafka-topics --create --topic example-topic --partitions 3 --replication-factor 2 --bootstrap-server localhost:9092
Expected OutputExpected
Created topic example-topic.
→
--partitions - Number of partitions to split the topic into for parallel processing.
→
--replication-factor - Number of copies of each partition for fault tolerance.
→
--bootstrap-server - Kafka server address to connect to.
Check the details of the topic to verify partitions and replication, confirming active-active setup.
Terminal
kafka-topics --describe --topic example-topic --bootstrap-server localhost:9092
Expected OutputExpected
Topic: example-topic PartitionCount: 3 ReplicationFactor: 2 Configs: Topic: example-topic Partition: 0 Leader: 1 Replicas: 1,2 Isr: 1,2 Topic: example-topic Partition: 1 Leader: 2 Replicas: 2,3 Isr: 2,3 Topic: example-topic Partition: 2 Leader: 3 Replicas: 3,1 Isr: 3,1
→
--describe - Show detailed information about the topic.
Start a producer to send messages to the topic, which will be handled by active brokers in active-active mode.
Terminal
kafka-console-producer --topic example-topic --bootstrap-server localhost:9092
Expected OutputExpected
No output (command runs silently)
→
--topic - Specify the topic to send messages to.
→
--bootstrap-server - Kafka server address to connect to.
Start a consumer to read all messages from the topic, showing how active-active setup allows continuous data flow.
Terminal
kafka-console-consumer --topic example-topic --bootstrap-server localhost:9092 --from-beginning
Expected OutputExpected
No output (command runs silently)
→
--from-beginning - Read messages from the start of the topic.
→
--topic - Specify the topic to read messages from.
→
--bootstrap-server - Kafka server address to connect to.
Key Concept

If you remember nothing else, remember: active-passive means one server works while the other waits, active-active means multiple servers work together at the same time for better availability and performance.

Common Mistakes
Setting replication-factor to 1 when expecting active-active behavior.
Without replication, data is not copied to other brokers, so failover and load sharing won't work.
Set replication-factor to at least 2 to enable data replication across brokers.
Using only one partition for a topic in active-active setup.
One partition limits parallelism and load distribution, reducing benefits of active-active.
Create multiple partitions to allow parallel processing across brokers.
Not verifying topic details after creation.
You might miss misconfigurations that prevent active-active operation.
Always describe the topic to confirm partitions and replication settings.
Summary
Create Kafka topics with multiple partitions and replication to enable active-active setups.
Use kafka-topics --describe to verify topic configuration.
Producers and consumers work with all active brokers to share load and provide fault tolerance.

Practice

(1/5)
1. Which statement best describes an active-passive Kafka cluster setup?
easy
A. One cluster is active handling all traffic, the other is standby for failover.
B. Both clusters actively handle traffic and share the load equally.
C. Clusters are inactive until manually started.
D. Clusters are used only for backup storage without processing.

Solution

  1. Step 1: Understand active-passive setup

    Active-passive means one system is active and the other waits as backup. One cluster is active handling all traffic, the other is standby for failover. matches this exactly: one active, one standby for failover.
  2. Final Answer:

    One cluster is active handling all traffic, the other is standby for failover. -> Option A
  3. Quick Check:

    Active-passive = one active, one standby [OK]
Hint: Active-passive means only one active system at a time [OK]
Common Mistakes:
  • Confusing active-active with active-passive
  • Thinking both clusters handle traffic simultaneously
  • Assuming passive cluster processes data
2. Which Kafka cluster configuration syntax correctly represents an active-active setup?
easy
A. A single cluster with no replication.
B. Two clusters with separate Zookeeper ensembles, both processing data simultaneously.
C. One cluster with a passive standby cluster defined but not processing data.
D. Two clusters where one is always offline.

Solution

  1. Step 1: Identify active-active setup syntax

    Active-active means multiple clusters actively processing data at the same time. Two clusters with separate Zookeeper ensembles, both processing data simultaneously. describes two clusters with separate Zookeeper ensembles both active simultaneously.
  2. Final Answer:

    Two clusters with separate Zookeeper ensembles, both processing data simultaneously. -> Option B
  3. Quick Check:

    Active-active = multiple active clusters [OK]
Hint: Active-active means multiple active clusters running simultaneously [OK]
Common Mistakes:
  • Choosing passive cluster syntax for active-active
  • Ignoring Zookeeper ensemble separation
  • Assuming single cluster can be active-active
3. Given two Kafka clusters configured in active-active mode, what is the expected behavior when a message is produced to both clusters simultaneously?
medium
A. Messages are processed independently and replicated asynchronously between clusters.
B. Only one cluster accepts messages; the other rejects them.
C. Messages are lost if produced to both clusters at the same time.
D. Clusters merge messages automatically without conflicts.

Solution

  1. Step 1: Understand active-active message handling

    In active-active, both clusters accept messages and replicate asynchronously. Messages are processed independently and replicated asynchronously between clusters. correctly states messages are processed independently and replicated asynchronously between clusters.
  2. Final Answer:

    Messages are processed independently and replicated asynchronously between clusters. -> Option A
  3. Quick Check:

    Active-active = independent processing + async replication [OK]
Hint: Active-active clusters replicate asynchronously, handling messages independently [OK]
Common Mistakes:
  • Assuming only one cluster accepts messages
  • Thinking messages get lost on simultaneous produce
  • Believing clusters merge messages automatically
4. You configured a Kafka cluster in active-passive mode but both clusters are processing messages simultaneously. What is the likely cause?
medium
A. Kafka does not support active-passive mode.
B. Passive cluster is offline.
C. Zookeeper ensemble is shared correctly.
D. Failover mechanism is not properly configured, causing both to be active.

Solution

  1. Step 1: Identify expected active-passive behavior

    Only one cluster should be active; the other should be standby. If both are active, failover or coordination is misconfigured, allowing both to process.
  2. Final Answer:

    Failover mechanism is not properly configured, causing both to be active. -> Option D
  3. Quick Check:

    Misconfigured failover = both active [OK]
Hint: Check failover setup if both active in active-passive mode [OK]
Common Mistakes:
  • Assuming Kafka can't do active-passive
  • Ignoring failover configuration
  • Thinking shared Zookeeper means passive is active
5. You want to design a Kafka deployment for a critical application requiring zero downtime and high throughput. Which setup is best and why?
hard
A. Single cluster with no replication, to reduce complexity.
B. Active-passive, because one cluster handles all traffic and the other is backup.
C. Active-active, because multiple clusters share load and provide failover simultaneously.
D. Passive-only clusters to save resources.

Solution

  1. Step 1: Identify requirements

    Zero downtime and high throughput require load sharing and failover. Active-active allows multiple clusters to share load and provide failover simultaneously.
  2. Final Answer:

    Active-active, because multiple clusters share load and provide failover simultaneously. -> Option C
  3. Quick Check:

    High availability + throughput = active-active [OK]
Hint: Active-active suits zero downtime and high throughput needs [OK]
Common Mistakes:
  • Choosing active-passive for high throughput
  • Ignoring failover and load sharing benefits
  • Selecting single cluster risking downtime
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard