简体   繁体   English

Kafka-python 获取主题的复制因子

[英]Kafka-python Get replication factor for a topic

Using this library , I was able to get the partition count per topic but not able to get the replication factor .使用这个,我能够获得partition count per topic但无法获得replication factor Closest question I could find was this for reference.我能找到的最接近的问题是这个供参考。 Any ideas on how to do it?关于如何做的任何想法?

If you use confluent-kafka library,如果你使用 confluent-kafka 库,

  1. Create AdminClient创建AdminClient

  2. Then ListTopics然后列出主题

  3. It will return ClusterMetaData它将返回ClusterMetaData

  4. Then, use topics' metadata from ClusterMetaData然后,使用 ClusterMetaData 中的主题元数据

  5. TopicMetadata has Partitions' metadata which has replica details TopicMetadata 具有分区的元数据,其中包含副本详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM