hbase版本为1.3.x or 1.4.x.
去github上下载二进制源码
# download and unpackage the most recent distribution:
$ wget "https://github.com/locationtech/geomesa/releases/download/geomesa_2.11-$VERSION/geomesa-hbase_2.11-$VERSION-bin.tar.gz"
$ tar xvf geomesa-hbase_2.11-$VERSION-bin.tar.gz
$ cd geomesa-hbase_2.11-$VERSION
$ ls
bin/ conf/ dist/ docs/ examples/ lib/ LICENSE.txt logs/
GeoMesa使用HBase过滤器和协处理器来加速查询。为了使用它们,必须将jar包部署到HBase.dynamic.jar.dir指定的目录中。默认为 ${hbase.rootdir}/lib
可通过将geomesa.hbase.remote.filtering 设置为 false 来禁用分布式处理
注册协处理器
1.自动注册
如果已经在HBase.dynamic.jar.dir下部署了jar文件。在调用createSchema时,协处理器将自动注册。
2.手动注册
a.在配置文件中注册
在hbase-site.xml中配置:
<configuration>
<property>
<name>hbase.coprocessor.user.region.classes</name>
<value>org.locationtech.geomesa.hbase.coprocessor.GeoMesaCoprocessor</value>
</property>
</configuration>
这时所有表都可以访问协处理器
b.在hbase shell中注册:
要在脱机情况下进行操作,在单独的表的基础上进行注册
在注册协处理器时,协处理器必须在classpath上可用,或者提供geomesa-hbase-distributed-runtime(一个jar文件)在hdfs上的URL。
索引表上需要注册协处理器,元数据表不需要注册协处理器
通过alter命令对表进行注册
协处理器参数的值有四个部分,由|(竖杠)分隔,其中两个部分HDFS_URL(路径)和PRIORITY(优先级)是可配置的。
'coprocessor'=>'HDFS_URL|org.locationtech.geomesa.hbase.coprocessor.GeoMesaCoprocessor|PRIORITY|'
当geomesa-hbase-distributed-runtime(jar文件)不在classpath上时,可以提供他在HDFS上的URL,
若要更改协处理器的优先级(执行顺序),可以将优先级更改为所需值,这是可选的,如果不使用,则应保留空白。
hbase(main):040:0> alter 'geomesa_QuickStart_id', METHOD => 'table_att', 'coprocessor'=>'|org.locationtech.geomesa.hbase.coprocessor.GeoMesaCoprocessor||'
Updating all regions with the new schema...
22/22 regions updated.
Done.
0 row(s) in 5.0000 seconds
hbase(main):041:0> alter 'geomesa_QuickStart_z2', METHOD => 'table_att', 'coprocessor'=>'|org.locationtech.geomesa.hbase.coprocessor.GeoMesaCoprocessor||'
Updating all regions with the new schema...
4/4 regions updated.
Done.
0 row(s) in 2.8850 seconds
hbase(main):042:0> alter 'geomesa_QuickStart_z3', METHOD => 'table_att', 'coprocessor'=>'|org.locationtech.geomesa.hbase.coprocessor.GeoMesaCoprocessor||'
Updating all regions with the new schema...
4/4 regions updated.
Done.
0 row(s) in 2.9150 seconds
判断是否修改成功:
hbase(main):002:0> describe 'TABLE_NAME'
Table TABLE_NAME is ENABLED
TABLE_NAME, {TABLE_ATTRIBUTES => {coprocessor$1 => '|org.locationtech.geomesa.hbase.coprocessor.GeoMesaCoprocessor||'}
COLUMN FAMILIES DESCRIPTION
{NAME => 'm', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_EN
CODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '655
36', REPLICATION_SCOPE => '0'}
1 row(s) in 0.1940 seconds
c.通过Classpath进行注册:
在单独的表的基础上进行注册
如果geomesa-hbase-distributed-runtime (jar文件)在Classpath上,那么当创建一个GeoMesa表时,协处理器会自动注册。要是想把JAR放在Classpath上,可以修改每个节点上的hbase-env.sh文件,并在HBASE_CLASSPATH属性中添加geomesa-hbase-distributed-runtime(jar文件)所在的文件路径。
d.通过配置进行注册:
。。。。。。。自己看官网吧。。。。。。。