天天看点

Geotrellis-spark-hbase-json

  • 背景概述

   应老板要求,指定我去搞定公司影像数据切片、存储至hbase后发map服务。数据处理方面,公司采用了Geotrellis-spark-ETL架构,之前处理好的数据一直存储到HDFS或者Accumulo中。鉴于处理后的数据产生太多小文件,对公司集群有压力,而Accumulo又是小众化,相应的开发,维护等等方面的资料奇缺,性能也不理想,所以老板考虑将数据全部迁移到hbase中。

  • 过程

   接到任务后,其实有些懵逼的:一,我本人之前并没有接触到hbase,毫无经验可谈;二,Geotrellis官方文档中也没有hbase相关资料;三,hbase的资料,网上一大堆,spark-hbase的资料也有,但是Geotrellis-spark-ETL-hbase的没有啊。

   没办法,硬着头皮接下任务。仔细分析了一下,将这个任务拆分为两部分:数据处理和发map服务,其中数据处理是基础,只有将入口的数据处理成公司业务需求的所需数据,才能使用这些数据发服务。

  数据处理方面,最关键的就是数据输入输出格式,后端格式的参数配置,采用json文件。

之前的json

Input.json:

[{

    "format": "multiband-geotiff",

    "name": "landsat",

    "cache": "NONE",

    "backend": {

        "type": "hadoop",

        "path": "hdfs://feiwei.node1:8020/geotrellis/gdal/r-g-n-rasters/"

    }

}]

Output.json:

{

  "backend": {

    "type": "hbase",

    "path": "http://feiwei.node1:60020/",

    "profile": "hbase-emr"

  },

  "reprojectMethod": "buffered",

  "cellSize": {

    "width": 256.0,

    "height": 256.0

  },

  "tileSize": 256,

  "pyramid": true,

  "resampleMethod": "bilinear",

  "keyIndexMethod": {

    "type": "zorder",

    "temporalResolution": 86400000

  },

  "layoutScheme": "zoomed",

  "crs": "EPSG:3857",

  "maxZoom": 13

}

Backend-profiles.json:

{

  "backend-profiles": [{

    "name": "hbase-gis",

    "type": "hbase",

    "zookeepers": "feiwei.node6:2181",

    "instance": "hbase",

    "user": "root",

    "password": "secret"

  }]

}

第一次修改

Input.json:

Geotrellis-spark-hbase-json

Output.json:

Geotrellis-spark-hbase-json

Backend.profiles.json:

Geotrellis-spark-hbase-json

第一次修改json后,报错:

Geotrellis-spark-hbase-json

之后的修改

多次修改,任然没有解决问题,在一次回头看源码的过程中却发现了其中缘由。

相关源码:

后端参数:

Geotrellis-spark-hbase-json

输出端参数:

Geotrellis-spark-hbase-json

正确的配置:

Input.json:

Geotrellis-spark-hbase-json

Output.json:

Geotrellis-spark-hbase-json

Backend-profiles.json:

Geotrellis-spark-hbase-json

三、

   历经十几次测试,修改,调整,最终将数据处理部分搞定,本篇算是记录一下Geotrellis-hbase-json吧。

继续阅读