Windows 7 安裝Apache kafka_2.11-0.9.0.1
下載所需文件
Zookeeper: http://www.apache.org/dyn/closer.cgi/zookeeper/
Kafka :http://kafka.apache.org/downloads.html
安裝Zookeeper
- 進入zookeeper設置目錄,E:\soft\elk\zookeeper-3.4.8\conf
- 將"zoo_sample.cfg" 復制一份,重命名為"zoo.cfg"
- 打開並編輯 並編輯dataDir=/tmp/zookeeper為指定目錄為E:/soft/elk/zookeeper-3.4.8/data
- 編輯環境變量,Path加 E:\soft\elk\zookeeper-3.4.8\bin
-
運行cmd,輸入zkserver ,成功如下
安裝Kafka
打開CMD 到E:\soft\elk\kafka_2.11-0.9.0.1這個路徑下
輸入bin\windows\kafka-server-start.bat config\server.properties
現在Kafka已經准備好並開始運行,可以創建主題來存儲消息了
創建主題
輸入
kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test1
創建Producer及Consumer來測試服務器。
輸入
kafka-console-producer.bat --broker-list localhost:9092 --topic test1
再打開一個cmd,輸入
kafka-console-consumer.bat --zookeeper localhost:2181 --topic test1
在producer命令行中任意輸入內容,回車;在其他consumer命令行中能看到相應消息