nerdexam
Confluent

CCDAK · Question #106

How will you set the retention for the topic named my-topic to 1 hour?

The correct answer is C. Set the topic config retention.ms to 3600000. Setting retention at the topic level (retention.ms = 3600000 via topic config) is the correct approach when targeting a specific topic like my-topic. Topic-level configs override broker defaults, giving you fine-grained control per topic. You'd apply this with kafka-configs.sh…

Deployment and Troubleshooting

Question

How will you set the retention for the topic named my-topic to 1 hour?

Options

  • ASet the broker config log.retention.ms to 3600000
  • BSet the consumer config retention.ms to 3600000
  • CSet the topic config retention.ms to 3600000
  • DSet the producer config retention.ms to 3600000

How the community answered

(29 responses)
  • A
    3% (1)
  • C
    93% (27)
  • D
    3% (1)

Explanation

Setting retention at the topic level (retention.ms = 3600000 via topic config) is the correct approach when targeting a specific topic like my-topic. Topic-level configs override broker defaults, giving you fine-grained control per topic. You'd apply this with kafka-configs.sh --alter --entity-type topics --entity-name my-topic --add-config retention.ms=3600000.

Why the distractors are wrong:

  • A - Broker config log.retention.ms sets a cluster-wide default affecting all topics, not just my-topic.
  • B & D - retention.ms is not a valid consumer or producer configuration; consumers and producers don't control how long data is stored on the broker - that's purely a broker/topic concern.

Memory tip: Think "retention lives where the data lives" - data is stored in topics on the broker, so retention is a topic config. If you need it cluster-wide, use the broker default; if you need it for one topic, override at the topic level.

Topics

#retention.ms#topic-level config#log retention#topic management

Community Discussion

No community discussion yet for this question.

Full CCDAK Practice