Kafka:常用查看命令

查看topic

bin/kafka-topics.sh \
--zookeeper emr-header-1:2181,emr-header-2:2181,emr-header-3:2181/kafka-1.0.1 \
--list

查看kafka的topic详细信息

bin/kafka-topics.sh \
--zookeeper emr-header-1:2181,emr-header-2:2181,emr-header-3:2181/kafka-1.0.1 \
--topic T1 \
--describe

查看消费者组

bin/kafka-consumer-groups.sh \
--bootstrap-server 172.1.2.3:9092,172.1.2.4:9092,172.1.2.5:9092 \
--list

查看消费者组详情

bin/kafka-consumer-groups.sh \
--bootstrap-server 172.1.2.3:9092,172.1.2.4:9092,172.1.2.5:9092 \
--group group_name1 \
--describe

查看__consumer_offsets中记载的偏移量数据

bin/kafka-console-consumer.sh --topic __consumer_offsets \
--bootstrap-server 172.1.2.3:9092,172.1.2.4:9092,172.1.2.5:9092 \
--formatter "kafka.coordinator.group.GroupMetadataManager\$OffsetsMessageFormatter" \
--consumer.config config/consumer.properties \
--from-beginning | grep group_name1 

查看topic信息最近5条

bin/kafka-console-consumer.sh \
--zookeeper emr-header-1:2181,emr-header-2:2181,emr-header-3:2181/kafka-1.0.1 \
--topic T2 \
--max-messages 5

指定消费者组消费主题数据:

bin/kafka-console-consumer.sh \
--bootstrap-server 172.1.2.3:9092,172.1.2.4:9092,172.1.2.5:9092 \
--topic T2 --group group_name1
posted @ 2019-01-03 14:49  xuejianbest  阅读(9077)  评论(0编辑  收藏  举报