1.打开新的cmd,输入“zkServer“,运行Zookeeper
2.启动kafka,进入kafka目录执行
.\bin\windows\kafka-server-start.bat .\config\server.properties
3.创建主题(topic=test)
.\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
4.查看主题
.\bin\windows\kafka-topics.bat --list --zookeeper localhost:2181
5.创建生产者
.\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic test
6.创建消费者
.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning
7.查看topic
.\bin\windows\kafka-topics.bat --describe --zookeeper localhost:2181 --topic test
评论区