0
0
Kafkadevops~10 mins

Client metrics monitoring in Kafka - Interactive Code Practice

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

Complete the code to start the Kafka consumer with the correct group ID.

Kafka
kafka-console-consumer --bootstrap-server localhost:9092 --topic metrics --group [1]
Drag options to blanks, or click blank then click option'
Aconsumer-1
Bmetrics-group
Cgroup-0
Ddefault
Attempts:
3 left
💡 Hint
Common Mistakes
Using an invalid or empty group ID causes the consumer to fail.
Confusing topic name with group ID.
2fill in blank
medium

Complete the command to produce a JSON metric message to the Kafka topic.

Kafka
echo '{"metric":"cpu_usage","value":75}' | kafka-console-producer --bootstrap-server localhost:9092 --topic [1]
Drag options to blanks, or click blank then click option'
Ametrics
Balerts
Cevents
Dlogs
Attempts:
3 left
💡 Hint
Common Mistakes
Sending metrics to the wrong topic causes data loss.
Misspelling the topic name.
3fill in blank
hard

Fix the error in the consumer command to correctly read from the beginning of the topic.

Kafka
kafka-console-consumer --bootstrap-server localhost:9092 --topic metrics --group consumer-1 --[1]
Drag options to blanks, or click blank then click option'
Astart-from-beginning
Bfrom-beginning
Cread-from-start
Dconsume-all
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect flag names causes the consumer to fail.
Omitting the flag reads only new messages.
4fill in blank
hard

Fill both blanks to configure the Kafka consumer to use a specific offset reset policy and enable auto commit.

Kafka
kafka-console-consumer --bootstrap-server localhost:9092 --topic metrics --group consumer-2 --consumer-property auto.offset.reset=[1] --consumer-property enable.auto.commit=[2]
Drag options to blanks, or click blank then click option'
Aearliest
Blatest
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Setting offset reset to latest misses old messages.
Disabling auto commit causes manual offset management.
5fill in blank
hard

Fill all three blanks to create a Kafka topic with 3 partitions, replication factor 2, and a retention time of 7 days.

Kafka
kafka-topics --create --bootstrap-server localhost:9092 --topic client-metrics --partitions [1] --replication-factor [2] --config retention.ms=[3]
Drag options to blanks, or click blank then click option'
A3
B2
C604800000
D86400000
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect retention time causes data to expire too soon or never.
Setting replication factor higher than cluster size causes errors.