0
0
Kafkadevops~10 mins

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

Choose your learning style9 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.