1,啟動zookeeper服務:zookeeper-server-start.sh -daemon zoo.cfg
2,啟動kafka服務:kafka-server-start.sh -daemon server.properties
3锡搜,查看有哪些主題: kafka-topics.sh --list --zookeeper master:2181
4栗涂,查看topic的詳細信息:kafka-topics.sh --zookeeper master:2181 -describe -topic test
5椎组,創(chuàng)建topic: kafka-topics.sh --zookeeper master:2181 --create --replication-factor 1 --partitions 1 --topic test1
6苇侵,為topic增加partition: kafka-topics.sh --zookeeper master:2181 -alter -partitions 20 -topic test1
7赶盔,kafka生產者客戶端命令: kafka-console-producer.sh --broker-list master:9092 -topic test1
8,kafka消費者客戶端命令:kafka-console-consumer.sh --zookeeper master:2181 --from-beginning -topic test1
? ? 新版本可以使用:kafka-console-consumer.sh --bootstrap-server master:9092 --from-beginning -topic test1
9衅檀,刪除topic:kafka-topics.sh --zookeeper master:2181 --delete --topic test
10招刨,查看consumer組內消費的offset:kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zookeeper master:2181 --group group --topic test1
? 或者:kafka-consumer-offset-checker.sh --zookeeper master:2181 --group owner --topic test1