Windows 安裝Kafka

來源:互聯網
上載者:User

標籤:

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\zookeeper-3.4.8\這個路徑下

輸入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命令列中能看到相應訊息

   

   

   

   

   

   

   

   

Windows 安裝Kafka

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.