Druid Kafka indexing service (Druid 導入Kafka 數據)

一、默認已經安裝Druid,如未安裝請參見上篇文章<Druid入門>

二、安裝Kafka環境。(單機測試)(Druid與Kafka在同一臺機器上)

     2.1 下載kafka

    curl -O http://www.us.apache.org/dist/kafka/0.9.0.0/kafka_2.11-0.9.0.0.tgz
    tar -xzf kafka_2.11-0.9.0.0.tgz
    cd kafka_2.11-0.9.0.0php

    2.2 啓動(因爲kafka與zookeeper在一臺機器上未修改配置)

     nohup ./bin/kafka-server-start.sh config/server.properties &html

   2.3 建立topic

   ./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic wikitickerapache

3.Enable Druid Kafka ingestion(啓用Druid Kafka攝入)(本身看着翻譯吧 ๑乛◡乛๑)

imply 默認提供了一個 demo  wikiticker-kafka-supervisor.json,是一個kafka的 配置
curl -XPOST -H'Content-Type: application/json' -d @quickstart/wikiticker-kafka-supervisor.json http://localhost:8090/druid/indexer/v1/supervisorjson

返回值:{"id":"wikiticker-kafka"}api

四、發送數據

 ./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic wikitickerapp

發送如下內容:
{"isRobot":false,"channel":"#en.wikipedia","timestamp":"2016-06-27T20:41:29.625Z","flags":"","isUnpatrolled":false,"page":"Indonesian future capital proposal","diffUrl":"https://en.wikipedia.org/w/index.php?diff=727266238&oldid=727256901","added":1467,"comment":"/* New capital city */ add Balikpapan and Palembang plus ref","commentLength":60,"isNew":false,"isMinor":false,"delta":1467,"isAnonymous":false,"user":"Gunkarta","deltaBucket":1400.0,"deleted":0,"namespace":"Main"}curl


5查看http://Ip:9095 (選擇建立的數據源)

參考文章:https://docs.imply.io/on-premise/tutorial-kafka-indexing-service測試

                 http://druid.io/docs/latest/ingestion/stream-pull.htmlui

相關文章
相關標籤/搜索