1.查看集群有哪些topic
./kafka-topics.sh —zookeeper node-1:2181,node-2:2181,node-3:2181 —list
2.创建topic(队列)
./kafka-topics.sh —zookeeper node-1:2181,node-2:2181,node-3:2181 —create topic t0916 —partitions 3 —replication-factor 3
3.控制台当生产者
./kafka-console-producer.sh —topic t0916 —broker —list—node-1:2181,node-2:2181,node-3:2181
4.控制台当消费者
./kafka-console-consumer.sh —zookeeper node-1:2181,node-2:2181,node-3:2181 —topic t0916
5.查看topic的描述信息
./kafka-topics.sh —zookeeper node-1:2181,node-2:2181,node-3:2181 —describe —topic t0916
6.查看producer生产消息的最大位置
./kafka-run-class-.sh kafka.tools.GetOffsetShell —broker-list node1:9092 —topic t0916 —time -1
7.删除topic
./kafka-topics.sh —zookeeper node-1:2181,node-2:2181,node-3:2181 —delete —topic t0916