How can I check the consumption status of a Kafka topic?

To check the consumption status of a topic in Kafka, you can use the following method:

  1. The script for managing Kafka consumer groups.
kafka-consumer-groups.sh --bootstrap-server <bootstrap_servers> --list

The represents the list of servers used for starting the Kafka cluster.

  1. Please provide the script kafka-consumer-groups.sh.
kafka-consumer-groups.sh --bootstrap-server <bootstrap_servers> --describe --group <consumer_group>

The is the name of the consumer group to be viewed.

  1. execute the Kafka class specified in the run script
kafka-run-class.sh kafka.tools.JmxTool --object-name kafka.consumer:type=consumer-fetch-manager-metrics,client-id=<client_id>,topic=<topic_name> --jmx-url service:jmx:rmi:///jndi/rmi://<kafka_host>:<jmx_port>/jmxrmi

represents the consumer’s client ID, is the name of the topic to be viewed, is the host address of the Kafka server, and is the JMX port on the Kafka server.

The methods above offer different ways to check the consumption status of topics in Kafka, you can choose the method that best suits your scenario and needs for viewing.

广告
Closing in 10 seconds
bannerAds