1.启动zookeeper
bin/zookeeper-server-start.sh &
2.启动kafka
nohup bin/kafka-server-start.sh config/server.properties &
3.创建topic
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
4.查看topic
bin/kafka-topics.sh --list --zookeeper localhost:2181 test
5.发送消息
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
This is a messageThis is another message
6.查看消息
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning