zoukankan      html  css  js  c++  java
  • Imply.io单机安装

    安装

    wget https://static.imply.io/release/imply-2.5.15.tar.gz 
    tar zxvf imply-2.5.15.tar.gz -C /usr/local/
    cd imply-2.5.15
    nohup bin/supervise -c conf/supervise/quickstart.conf > quickstart.log &

    查看启动日志

    [root@localhost imply-2.5.15]# tail -f quickstart.log 
    [Sat Jun  9 11:32:22 2018] Running command[zk], logging to[/usr/local/imply-2.5.15/var/sv/zk.log]: bin/run-zk conf-quickstart
    [Sat Jun  9 11:32:22 2018] Running command[coordinator], logging to[/usr/local/imply-2.5.15/var/sv/coordinator.log]: bin/run-druid coordinator conf-quickstart
    [Sat Jun  9 11:32:22 2018] Running command[broker], logging to[/usr/local/imply-2.5.15/var/sv/broker.log]: bin/run-druid broker conf-quickstart
    [Sat Jun  9 11:32:22 2018] Running command[historical], logging to[/usr/local/imply-2.5.15/var/sv/historical.log]: bin/run-druid historical conf-quickstart
    [Sat Jun  9 11:32:22 2018] Running command[overlord], logging to[/usr/local/imply-2.5.15/var/sv/overlord.log]: bin/run-druid overlord conf-quickstart
    [Sat Jun  9 11:32:22 2018] Running command[middleManager], logging to[/usr/local/imply-2.5.15/var/sv/middleManager.log]: bin/run-druid middleManager conf-quickstart
    [Sat Jun  9 11:32:22 2018] Running command[imply-ui], logging to[/usr/local/imply-2.5.15/var/sv/imply-ui.log]: bin/run-imply-ui-quickstart conf-quickstart

    可见启动了如下服务

    服务 简介 访问地址
    zookeeper 分布式协调服务 ——
    coordinator 协调节点,管理集群状态 http://localhost:8081/#/
    broker 查询节点,处理查询请求 http://localhost:8082/druid/v2
    historical 历史节点,管理历史数据 http://localhost:8083/druid/v2
    overlord 统治节点,管理数据写入任务 http://localhost:8090/console.html
    middleManager 中间管理者,负责写数据处理 ——
    imply-ui 数据查询Web UI http://localhost:9095/datasets/

    数据导入与查询

    导入离线数据与查询

    数据导入与查询

    导入离线数据与查询

    • quickstart/wikipedia-2016-06-27-sampled.json文件包含了维基百科的一些日志数据(每行是一个JSON字符串)

    • quickstart/wikipedia-index.json文件为离线写入任务的描述文件,其用JSON格式描述了任务的数据源、时间信息、维度信息、指标信息等

    将这些数据导入到Druid中

    bin/post-index-task --file quickstart/wikipedia-index.json

    可能会报“ImportError: No module named argparse”的错误,执行pip install argparse安装即可解决

    bin/post-index-task --file quickstart/wikipedia-index.json 
    Beginning indexing data for wikipedia
    Task started: index_wikipedia_2018-06-09T04:03:26.580Z
    Task log:     http://localhost:8090/druid/indexer/v1/task/index_wikipedia_2018-06-09T04:03:26.580Z/log
    Task status:  http://localhost:8090/druid/indexer/v1/task/index_wikipedia_2018-06-09T04:03:26.580Z/status
    Task index_wikipedia_2018-06-09T04:03:26.580Z still running...
    Task index_wikipedia_2018-06-09T04:03:26.580Z still running...
    Task finished with status: SUCCESS
    Completed indexing data for wikipedia. Now loading indexed data onto the cluster...
    wikipedia is 0.0% finished loading...
    wikipedia loading complete! You may now query your data

    查询数据

    访问http://localhost:9095,可以查看当前数据集的概况和字段信息等

    查询编辑次数TOP5的页面

    方式一切到SQL标签,输入以下SQL

    SELECT page, COUNT(*) AS Edits
    FROM wikipedia
    WHERE "__time" BETWEEN TIMESTAMP '2016-06-27 00:00:00' AND TIMESTAMP '2016-06-28 00:00:00'
    GROUP BY page
    ORDER BY Edits
    DESC LIMIT 5

    方式二直接通过CURL查询

    quickstart/wikipedia-top-pages.json中定了查询的JSON文件

    curl -X 'POST' -H 'Content-Type:application/json' -d @quickstart/wikipedia-top-pages.json http://localhost:8082/druid/v2?pretty

    返回

    [ {
      "timestamp" : "2016-06-27T00:00:11.080Z",
      "result" : [ {
        "count" : 29,
        "page" : "Copa América Centenario"
      }, {
        "count" : 16,
        "page" : "User:Cyde/List of candidates for speedy deletion/Subpage"
      }, {
        "count" : 16,
        "page" : "Wikipedia:Administrators' noticeboard/Incidents"
      }, {
        "count" : 15,
        "page" : "2016 Wimbledon Championships – Men's Singles"
      }, {
        "count" : 15,
        "page" : "Wikipedia:Administrator intervention against vandalism"
      } ]
    } ]

    实时导入与查询

    发送数据

    bin/generate-example-metrics可以产生一些随机的样例metric,运行下面的语句

    [root@localhost imply]# bin/generate-example-metrics | curl -XPOST -H'Content-Type: application/json' --data-binary @- 
    http://localhost:8200/v1/post/tutorial-tranquility-server

    返回结果如下

    {"result":{"received":25,"sent":25}}
  • 相关阅读:
    NOIP2016 蚯蚓 题解
    BZOJ 1294 围豆豆 题解
    POJ1852 Ants 题解
    BZOJ 1131 [POI2008] STA-Station 题解
    HDU 5963 朋友 题解
    Codeforces 1292C Xenon's Attack on the Gangs 题解
    Emergency Evacuation 题解
    P4408 逃学的小孩 题解
    UVA11300 Spreading the Wealth 题解
    P2882 Face The Right Way G 题解
  • 原文地址:https://www.cnblogs.com/lenmom/p/9171494.html
Copyright © 2011-2022 走看看