1. 创建topic
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic testTopic1
2. 查看已经创建的topic信息
bin/kafka-topics.sh --list --zookeeper localhost:2181
3. 生产者发送消息
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testTopic1
This is a message
This is another message
4. 消费者消费消息
bin/kafka-console-consumer.sh --bootstrap-server localhost:2181 --from-beginning --topic testTopic1