美文网首页
在windows初装kafka

在windows初装kafka

作者: 小狼在IT | 来源:发表于2018-12-20 17:31 被阅读0次

1.下载kafka:
http://kafka.apache.org/downloads

image.png

2.解压


image.png

3.运行
CMD到这里:


image.png

1).启动zookeeper
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
执行后不关闭

2).启动kafka
.\bin\windows\kafka-server-start.bat .\config\server.properties
执行后不关闭

3).创建主题
.\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test0811
执行后可关闭

最好,就可以用起来了:
运行两个CMD,一个跑生产者,一个跑消费者:
生产者
.\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic test0811

消费者
.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test0811 --from-beginning

image.png

在右边的生产者输入内容,左边的消费者就能显示出来。

相关文章

网友评论

      本文标题:在windows初装kafka

      本文链接:https://www.haomeiwen.com/subject/mfqukqtx.html