版本:3.6.0
1.kafka-topics.sh
Create, delete, describe, or change a topic
创建、删除、描述或更改主题
查看所有topic
kafka-topics.sh --bootstrap-server centos701:9092,centos702:9092,centos704:9092 --list
描述topic详情
kafka-topics.sh --bootstrap-server centos701:9092,centos702:9092,centos704:9092 --describe --topic first
2.kafka-console-consumer.sh
This tool helps to read data from Kafka topics and outputs it to standard output
该工具读取Kafka主题中的数据,并将其输出到标准输出
消费主题中的数据
kafka-console-consumer.sh --bootstrap-server centos701:9092,centos702:9092,centos704:9092 --topic first
从头开始消费数据
kafka-console-consumer.sh --bootstrap-server centos701:9092,centos702:9092,centos704:9092 --from-beginning --topic first
指定消费者组消费
kafka-console-consumer.sh --bootstrap-server centos701:9092,centos702:9092,centos704:9092 --from-beginning --topic first --group first_group
3.kafka-consumer-groups.sh
查看所有消费者组
kafka-consumer-groups.sh --bootstrap-server centos701:9092,centos702:9092,centos704:9092 --list
运行结果
root@hcss-ecs-6296:/home/kafka/opt/kafka_2.13-3.6.0# ./bin/kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 --list
video_retrieval
service-ai-analysis-access
描述指定消费者组
kafka-consumer-groups.sh --bootstrap-server centos701:9092,centos702:9092,centos704:9092 --describe --group first_group