kafka:1.运行zookeeper
2.在kafka的安装目录下cmd输入:.\bin\windows\kafka-server-start.bat .\config\server.properties
3.创建主题:在kafka/bin/windows下cmd:kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
4.创建生产者(producer):在kafka/bin/windows下cmd:kafka-console-producer.bat --broker-list localhost:9092 --topic test
5.创建消费者(consumer):kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning
网友评论