0
0
Kafkadevops~10 mins

Retention policies (time-based, size-based) 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 set a time-based retention policy of 7 days for a Kafka topic.

Kafka
retention.ms=[1]  # Set retention to 7 days in milliseconds
Drag options to blanks, or click blank then click option'
A259200000
B604800000
C86400000
D3600000
Attempts:
3 left
💡 Hint
Common Mistakes
Using seconds or minutes instead of milliseconds.
Confusing retention.ms with retention.bytes.
2fill in blank
medium

Complete the code to set a size-based retention policy of 1 GB for a Kafka topic.

Kafka
retention.bytes=[1]  # Set retention size to 1 GB
Drag options to blanks, or click blank then click option'
A1024000000
B1048576
C1000000000
D1073741824
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1,000,000,000 bytes instead of 1,073,741,824 bytes.
Confusing retention.bytes with retention.ms.
3fill in blank
hard

Fix the error in the retention policy configuration to correctly set retention to 3 days.

Kafka
retention.ms = [1]  # Intended 3 days retention
Drag options to blanks, or click blank then click option'
A86400000
B300000
C259200000
D3600000
Attempts:
3 left
💡 Hint
Common Mistakes
Using 300000 which is 5 minutes.
Using 86400000 which is 1 day.
4fill in blank
hard

Fill both blanks to create a retention policy that deletes messages older than 2 days or when the log size exceeds 500 MB.

Kafka
retention.ms = [1]
retention.bytes = [2]
Drag options to blanks, or click blank then click option'
A172800000
B524288000
C1048576000
D86400000
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up retention.ms and retention.bytes values.
Using 1 GB instead of 500 MB for retention.bytes.
5fill in blank
hard

Fill all three blanks to configure a Kafka topic with a retention time of 12 hours, a retention size of 200 MB, and a cleanup policy of delete.

Kafka
retention.ms = [1]
retention.bytes = [2]
cleanup.policy = "[3]"
Drag options to blanks, or click blank then click option'
A43200000
B209715200
Cdelete
Dcompact
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'compact' instead of 'delete' for cleanup.policy.
Mixing up retention.ms and retention.bytes values.