Kafka consumer list

前端 未结 8 1836
日久生厌
日久生厌 2020-12-12 19:38

I need to find out a way to ask Kafka for a list of topics. I know I can do that using the kafka-topics.sh script included in the bin\\ directory.

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-12 20:07

    I realize that this question is nearly 4 years old now. Much has changed in Kafka since then. This is mentioned above, but only in small print, so I write this for users who stumble over this question as late as I did.

    1. Offsets by default are now stored in a Kafka Topic (not in Zookeeper any more), see Offsets stored in Zookeeper or Kafka?
    2. There's a kafka-consumer-groups utility which returns all the information, including the offset of the topic and partition, of the consumer, and even the lag (Remark: When you ask for the topic's offset, I assume that you mean the offsets of the partitions of the topic). In my Kafka 2.0 test cluster:
    kafka-consumer-groups --bootstrap-server kafka:9092 --describe
        --group console-consumer-69763 Consumer group 'console-consumer-69763' has no active members.
    
    TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID     HOST            CLIENT-ID
    pytest          0          5               6               1               -               -               -
    ``
    
    
    

提交回复
热议问题