Bird
Raised Fist0
Kafkadevops~10 mins

Active-passive vs active-active in Kafka - Interactive Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set up a Kafka consumer in active-passive mode.

Kafka
consumer = KafkaConsumer('my_topic', group_id=[1], bootstrap_servers=['localhost:9092'])
Drag options to blanks, or click blank then click option'
A'active-passive-group'
B'active-active-group'
C'random-group'
D'passive-group'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different group IDs disables failover behavior.
2fill in blank
medium

Complete the code to configure Kafka producers for active-active replication.

Kafka
producer = KafkaProducer(acks=[1], bootstrap_servers=['localhost:9092'])
Drag options to blanks, or click blank then click option'
Anone
B'all'
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using acks=0 risks message loss in active-active setups.
3fill in blank
hard

Fix the error in the consumer group configuration for active-active mode.

Kafka
consumer = KafkaConsumer('topic', group_id=[1], bootstrap_servers=['localhost:9092'])
Drag options to blanks, or click blank then click option'
Anull
B'active-passive-group'
C'active-active-group'
D'single-consumer-group'
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning a group ID causes consumers to share partitions, not active-active.
4fill in blank
hard

Fill both blanks to create a Kafka topic with replication and partition count for active-active setup.

Kafka
admin_client.create_topics([NewTopic(name='my_topic', num_partitions=[1], replication_factor=[2])])
Drag options to blanks, or click blank then click option'
A3
B1
C2
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using replication factor 1 risks data loss in active-active.
5fill in blank
hard

Fill all three blanks to configure a Kafka consumer with manual commit in active-passive mode.

Kafka
consumer = KafkaConsumer('topic', group_id=[1], enable_auto_commit=[2], auto_offset_reset=[3], bootstrap_servers=['localhost:9092'])
Drag options to blanks, or click blank then click option'
A'active-passive-group'
BFalse
C'earliest'
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving auto commit enabled causes unexpected offset commits.

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