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

相关文章
相关标签/搜索