生产
kafka-console-producer.sh –broker-list 172.17.201.234:9092 –topic test-yeyu
消费
kafka-console-consumer.sh –bootstrap-server 172.17.201.234:9092 –from-beginning –topic test-yeyu (–from-beginning 从头开始)
a.创建topic
kafka-topics.sh –create –zookeeper node1:2181 –replication-factor 1 –partitions 1 –topic my-kafka-topic
b.查看topic列表
kafka-topics.sh –list –zookeeper node01:2181
c.如果需要查看topic的详细信息,需要使用describe命令
kafka-topics.sh –describe –zookeeper node1:2181 –topic test-topic
d.#若不指定topic,则查看所有topic的信息
kafka-topics.sh –describe –zookeeper node1:2181
e.删除topic
kafka-topics.sh –delete –zookeeper node1:2181 –topic my-kafka-topic