進入kafka目錄下,新建文件夾 kafka-logs 與文件夾 zk-dir,進入config目錄下,打開server.propertiesgit
broker.id=1 log.dirs=../kafka-logs
找到 dataDirs,改成shell
dataDir=../zk-dir
使用 powerShell 或 cmd 或 git Bash 打開到安裝 kafka 的目錄下,黏貼一下命令,執行即可bootstrap
bin/windows/zookeeper-server-start.bat config/zookeeper.properties
從新打開一個 powerShell 或 cmd 或 git Bash,一樣 cd 到 kafka 的安裝目錄下。輸入一下命令。windows
bin/windows/kafka-server-start.bat config/server.properties
啓動完成code
建立 test 的 topicserver
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic merchants-template
bin/windows/kafka-topics.bat --list --zookeeper localhost:2181
bin/windows/kafka-console-producer.bat --broker-list localhost:9092 --topic merchants-template
bin/windows/kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic merchants-template --from-beginning
人若無名,專心練劍! 喜歡的朋友能夠留下你的贊!教程