1.查看topic列表
./kafka-topics.sh --list --zookeeper master:2181
查看topic详情
#./kafka-topics.sh --zookeeper master:2181 --topic designTopic --describe
Topic:designTopic PartitionCount:1 ReplicationFactor:1 Configs:
Topic: designTopic Partition: 0 Leader: 1002 Replicas: 1002 Isr: 1002
2.创建topic
./kafka-topics.sh --create --zookeeper master:2181 --replication-factor 1 --partitions 1 --topic testMyTopic
3.创建生产者
./kafka-console-producer.sh --broker-list slave203:6667 --topic designTopic
4.创建消费者
./kafka-console-consumer.sh -zookeeper master:2181 --topic designTopic
新版kafka ./kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic designTopic