drill http 存储插件试用

以下是对于http 存储插件的试用

环境准备

  • docker 启动drill (1.18.0 )
docker run -i --name drill-1.18.0 -p 8047:8047 -p 31010:31010 -p 31011:31011 -p 31012:31012 -t apache/drill:1.18.0 /bin/bash

配置http 存储插件

  • 参考格式
{
  "type": "http",
  "cacheResults": true,
  "connections": {},
  "timeout": 0,
  "proxyHost": null,
  "proxyPort": 0,
  "proxyType": null,
  "proxyUsername": null,
  "proxyPassword": null,
  "enabled": true
}
  • 说明
    上边的connections 是核心,配置如下:
    URL : 指定需要访问的url信息, 可以指定的配置requireTail,params
    requireTai,进行url的拼接处理 ,默认false
    比如:
 
url: "https://api.sunrise-sunset.org/json?lat=36.7201600&lng=-4.4203400&date=2019-10-02",
requireTail: false

sql 查询:

SELECT * FROM api.sunrise;

为true的模式

url: "https://api.sunrise-sunset.org/json",
requireTail: true

sql 查询:

SELECT * FROM api.sunrise.`?lat=36.7201600&lng=-4.4203400&date=2019-10-02`

params 指定:
参考:

 
url: "https://api.sunrise-sunset.org/json",
requireTail: false,
params: ["lat", "lng", "date"]

sql 查询:

SELECT * FROM api.sunrise
WHERE `lat` = 36.7201600 AND `lng` = -4.4203400 AND `date` = '2019-10-02'

Method: 指定http请求的verb
包含了method:post,get postBody: 指定请求提内容
Headers: 指定http 请求头信息
Authorization: 指定http 请求的授权模式,目前暂时只支持basic 认证默认,后期会有其他模式的支持
其他相关配置:http proxy 配置,具体可以参考以下的连接

简单使用

  • 配置存储插件

 

 

  • 数据查询

 

 


效果

 

 

说明

drill 的http 存储扩展还是很不错的功能,基于次我们也可以用来分析prometheus 的metrics (基于http api),以及其他基于http的请求

参考资料

https://github.com/apache/drill/tree/master/contrib/storage-http

posted on 2020-10-06 21:22  荣锋亮  阅读(270)  评论(0编辑  收藏  举报

导航