Set topic retention

Set 7-day retention on a topic

kafka-configs.sh --bootstrap-server kafka:9092 --alter --entity-type topics --entity-name my-topic --add-config retention.ms=604800000

tool
kafka20 commands
tags
kafka

More kafka commands

  • kafka-broker-api-versions.sh --bootstrap-server kafka:9092

    List all API versions supported by the broker

  • kafka-topics.sh --bootstrap-server kafka:9092 --list

    List all Kafka topics in the cluster

  • kafka-topics.sh --bootstrap-server kafka:9092 --create --topic <name> --partitions 3 --replication-factor 2

    Create topic with specific partition and replication settings

  • kafka-topics.sh --bootstrap-server kafka:9092 --describe --topic <name>

    Show partition count, replication, leaders and ISR

  • kafka-topics.sh --bootstrap-server kafka:9092 --delete --topic <name>

    Permanently delete a Kafka topic

all 20 kafka commands