Support Questions

Find answers, ask questions, and share your expertise

Getting the properties of topics in kafka

avatar
Explorer

Hi,

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?

2 REPLIES 2

avatar
Guru

Hi @Lucky_Luke,

the script "kafka-topics.sh" 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/kafka-topics.sh --zookeeper sandbox.hortonworks.com:2181/kafka --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

avatar
New Contributor

Hi @Gerd Koeing

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