drill 集成开源s3 存储minio

drill 支持s3数据的查询,同时新版的通过简单配置就可以实现minio 的集成

测试使用docker 运行drill 参考 https://www.cnblogs.com/rongfengliang/p/9846899.html,minio 安装也可以使用docker
minio bucket 创建以及文件上传可以使用UI 或者mc

配置

  • s3 配置说明
{
  "type": "file",
  "connection": "s3a://app/",
  "config": {
    "fs.s3a.access.key": "<key>",
    "fs.s3a.secret.key": "<secret>",
    "fs.s3a.endpoint": "<minio server>",
    "fs.s3a.connection.ssl.enabled": "false", // default isn't  ssl
    "fs.s3a.path.style.access": "true" 
  },
  "workspaces": {
    "root": {
      "location": "/",
      "writable": false,
      "defaultInputFormat": null,
      "allowAccessOutsideWorkspace": false
    },
    "tmp": {
      "location": "/tmp",
      "writable": true,
      "defaultInputFormat": null,
      "allowAccessOutsideWorkspace": false
    }
  },
  "formats": {
    "psv": {
      "type": "text",
      "extensions": [
        "tbl"
      ],
      "delimiter": "|"
    },
    "csv": {
      "type": "text",
      "extensions": [
        "csv"
      ],
      "delimiter": ","
    },
    "tsv": {
      "type": "text",
      "extensions": [
        "tsv"
      ],
      "delimiter": "\t"
    },
    "parquet": {
      "type": "parquet"
    },
    "json": {
      "type": "json",
      "extensions": [
        "json"
      ]
    },
    "avro": {
      "type": "avro"
    },
    "sequencefile": {
      "type": "sequencefile",
      "extensions": [
        "seq"
      ]
    },
    "csvh": {
      "type": "text",
      "extensions": [
        "csvh"
      ],
      "extractHeader": true,
      "delimiter": ","
    }
  },
  "enabled": true
}
  • 查询
select * from s3.`root`.`user.json`
  • minio 添加数据
{"name":"dalong","age":33}
{"name":"dalong","age":33}
{"name":"dalong","age":33}
{"name":"dalong","age":33}
{"name":"dalong","age":33}
{"name":"dalong","age":33}
{"name":"dalong","age":33}
{"name":"dalong","age":33}
{"name":"dalong","age":33}
{"name":"dalong","age":33}

效果


参考资料

https://blog.minio.io/query-minio-datastore-with-apache-drill-dcaf71d0cee5?_branch_match_id=520116032687566918
https://www.cnblogs.com/rongfengliang/p/9846899.html
http://drill.apache.org/docs/s3-storage-plugin/

posted on 2018-10-25 08:54  荣锋亮  阅读(486)  评论(0编辑  收藏  举报

导航