kafka commands - xingzhihe/hello-world GitHub Wiki

cd /opt/cloudera/parcels/KAFKA/lib/kafka

kafka log.dirs

ls /var/local/kafka/data/

查看topic列表

bin/kafka-topics.sh --zookeeper 10.10.8.102:2181 --list

删除topic

bin/kafka-topics.sh --zookeeper 10.10.8.102:2181 --delete --topic bsdt_phmx_hxz

查看消费者群组

bin/kafka-consumer-groups.sh --bootstrap-server 10.10.8.102:9092 --list

查看消费者详细信息

bin/kafka-consumer-groups.sh --bootstrap-server 10.10.8.102:9092 --describe --group grp_hxz

查看消费者详细信息

bin/kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zookeeper 10.10.8.102:2181 --topic bsdt_phmx_hxz --group grp_hxz

生产者控制台

bin/kafka-console-producer.sh --broker-list 10.10.8.102:9092,10.10.8.104:9092,10.10.8.107:9092 --topic bsdt_fwmx_hxz

消费者控制台

bin/kafka-console-consumer.sh --bootstrap-server 10.10.8.102:9092,10.10.8.104:9092,10.10.8.107:9092 --from-beginning --topic bsdt_phmx_hxz