How to purge a Kafka Topic?

Written by Lovisa Johansson

Frequently Asked Apache Kafka Question: How do I purge a Kafka Topic?

The easiest way to purge a topic is to temporarily change the retention time and then resetting it back.

Start by updating the retention time on the topic to one second and then wait for the purge to take effect. Once the topic is purged, you can restore the previous retention.ms value.

CloudKarafka allows users to configure the retention period on a per-topic basis. The time can be specified via the Kafka management interface for dedicated plans or via the topics tab for the plan Developer Duck.

CloudKarafka - Industry Leading Apache Kafka as a Service