本地zookeeper的啓動,kafka的啓動

建議kafka使用可視化工具:

https://blog.csdn.net/weixin_39249427/article/details/99642613

 

安裝bin目錄下:

zkServer.cmd

windows\kafka-server-start.bat ..\config\server.properties

之後進入到kafka的目錄下執行下面的命令,可以使用在文件夾的空白處按着shift加鼠標右鍵打開命令窗口

windows\kafka-server-start.bat ..\config\server.properties

!每次運行kafka的時候都要把這個和上面的zkserver開啓
之後可以測試一下創建一個主題

.\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 3 --topic hello

之後開啓生產者,進入到bin/windows目錄下使用命令窗口

.\kafka-console-producer.bat --broker-list localhost:9092 --topic test
.\kafka-console-producer.bat --broker-list localhost:9092 --topic hello
 

開啓消費者,進入到bin/windows目錄下使用命令窗口
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
.\kafka-console-consumer.bat --bootstrap-server localhost:2181 --topic test --from-beginning
之後可以在生產者那個窗口隨意輸入一些信息,之後就能在消費者那邊看到輸入的信息


D:\software\kafka\kafka-2.3.0-src\bin\windows>kafka-topics.bat --zookeeper localhost:2181 --describe --topic testS
D:\software\kafka\kafka-2.3.0-src\bin\windows>kafka-topics.bat --bootstrap-server localhost:2181 --describe --topic testS
Topic:testS     PartitionCount:1        ReplicationFactor:1     Configs:
        Topic: testS    Partition: 0    Leader: 0       Replicas: 0     Isr: 0
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章