How to use Kafka command to view topic consumption stat…
To check the consumption status of a topic using Kafka commands, you can use the following command:
- View consumer group information:
kafka-consumer-groups.sh --bootstrap-server <kafka服务器地址> --group <消费者组名称> --describe
This will display detailed information about consumers in a given consumer group, including the current topic being consumed and the offset of the consumption.
- Viewing consumer offsets for a specific topic.
kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list <kafka服务器地址> --topic <topic名称> --time -1
This will display the consumer offsets for each partition of the given topic.
- Review the consumption behavior of consumer groups for a specific topic.
kafka-consumer-groups.sh --bootstrap-server <kafka服务器地址> --group <消费者组名称> --topic <topic名称> --describe
This will display the consumption status of a given consumer group on a specific topic, including the offset and lag for each consumer (difference from the latest message offset).
Please make sure to replace