0
0
Kafkadevops~10 mins

Topic configuration 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 create a Kafka topic with 3 partitions.

Kafka
bin/kafka-topics.sh --create --topic my-topic --partitions [1] --bootstrap-server localhost:9092
Drag options to blanks, or click blank then click option'
A5
B1
C0
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 partitions which is invalid.
Using a string instead of a number.
2fill in blank
medium

Complete the code to set the replication factor to 2 when creating a Kafka topic.

Kafka
bin/kafka-topics.sh --create --topic my-topic --replication-factor [1] --bootstrap-server localhost:9092
Drag options to blanks, or click blank then click option'
A3
B2
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Setting replication factor to 0 which is invalid.
Setting replication factor higher than available brokers.
3fill in blank
hard

Fix the error in the command to set the cleanup policy to 'compact' for a Kafka topic.

Kafka
bin/kafka-configs.sh --alter --entity-type topics --entity-name my-topic --add-config cleanup.policy=[1] --bootstrap-server localhost:9092
Drag options to blanks, or click blank then click option'
Adelete
Bcompact,delete
Ccompact
Dcompress
Attempts:
3 left
💡 Hint
Common Mistakes
Using an invalid cleanup policy value.
Using 'compress' which is not a valid cleanup policy.
4fill in blank
hard

Fill both blanks to create a topic with 4 partitions and a retention time of 1 day (86400000 ms).

Kafka
bin/kafka-topics.sh --create --topic my-topic --partitions [1] --config retention.ms=[2] --bootstrap-server localhost:9092
Drag options to blanks, or click blank then click option'
A4
B86400000
C3600000
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing retention time units.
Setting partitions to an invalid number.
5fill in blank
hard

Fill all three blanks to create a topic named 'logs' with 6 partitions, replication factor 3, and cleanup policy 'delete'.

Kafka
bin/kafka-topics.sh --create --topic logs --partitions [1] --replication-factor [2] --config cleanup.policy=[3] --bootstrap-server localhost:9092
Drag options to blanks, or click blank then click option'
A3
B6
Cdelete
Dcompact
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up partitions and replication factor values.
Using invalid cleanup policy values.