1.从topic中读取数据通过grep设置关键词过滤保存到文件中
bash kafka-console-consumer.sh --zookeeper mfcrawl01.eastus.cloudapp.azure.com:2181/kafka08 --topic DS.crawl.output.mf.azure.foreign --from-beginning | grep keywords > logs
2.创建topic
kafka-topics.sh --zookeeper localhost:2181/kafka08 --create --topic test --replication-factor 3 --partitions 3
3.增加分区
kafka-topics.sh --zookeeper localhost:2181/kafka08 --topic test --alter --partitions 8
4.删除topic
kafka-topics.sh --zookeeper localhost:2181/kafka08 --topic test --delete
5.列出所有的主题
kafka-topics.sh --zookeeper localhost:2181/kafka08 --list
6.列出主题的详细信息
kafka-topics.sh --zookeeper localhost:2181/kafka08 --describe
7.列出群组信息
kafka-consumer-groups.sh --new-consumer --bootstrap-server localhost:9092/kafka08 --list
8.列出群组的详细信息
kafka-consumer-groups.sh --new-consumer --bootstrap-server localhost:9092/kafka08 --describe --group groupName
9.导出偏移量信息
kafka-run-class.sh kafka.tools.ExportZKOffsets --zkconnect localhost:2181/kafka08 --group groupName --output-file fileName
10.查看偏移量信息
kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zookeeper localhost:2181/kafka08 --group groupName