Support Questions

Find answers, ask questions, and share your expertise

Getting the properties of topics in kafka



I am using a kafka cluster with three brokers, I would like to know the topics resides in this cluster, for each topic, how many partitions we have and what is TTL related to them.

How to identify such things in a horthonwork cluster?



Hi @Lucky_Luke,

the script "" with parameter "--describe" is what you are looking for.

To get details for a certain topic, e.g. "test-topic", you would call (adjust zookeeper connect string according to your env.):

/usr/hdp/current/kafka-broker/bin/ --zookeeper --describe --topic test-topic

The output contains (amongst others) no. of partitions, leading broker for each partition, in-snyc-replicas

The topic-level configuration properties are listed under "Configs:" . If this is blank, then the default (broker-wide) settings are applied and you should check your broker config file (or Ambari section) for property "log.retention.hours" ...... assuming you mean the retention time by mentioning "TTL"

HTH, Gerd

New Contributor

Hi @Gerd Koeing

I am unable to find "configs" ? Is this a part of any file ?

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.