1.启动Zookeeper服务
bin/zookeeper-server-start.sh config/zookeeper.properties
2.启动Kafka服务
bin/kafka-server-start.sh config/server.properties
3.创建Topic
bin/kafka-topics.sh --create --topic test --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1
4.发送消息
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
5.接收消息
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning