HBase REST:声明一个协处理器

时间:2015-07-03 21:58:47

标签: hbase stargate

我很难通过HBase REST创建一个带协处理器的HBase表。

hbase_table_ttt.xml

<?xml version="1.0" encoding="UTF-8" ?>
<TableSchema name="ttt" coprocessor="hdfs:///my_coprocessor-1.0.jar|com.mycompany.MyCoprocessor|1001|">
    <ColumnSchema name="d" BLOCKCACHE="true" VERSIONS="1" IN_MEMORY="true"/>
</TableSchema>

通过后续调用创建表格:

TARGET_HOST="hbase-instance-with-rest.amazonaws.com:8080"
curl -X PUT -H "Content-Type: text/xml" -H "Accept: text/xml" -d @hbase_table_ttt.xml http://$TARGET_HOST/ttt/schema/

导致以下架构,禁用协处理器:

'ttt', {METHOD => 'table_att', CONFIG => {'coprocessor' => 'hdfs:///my_coprocessor-1.0.jar|com.mycompany.MyCoprocessor|1001|'}}, 
       {NAME => 'd', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', 
        MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', 
        IN_MEMORY => 'true', ENCODE_ON_DISK => 'true', BLOCKCACHE=>'true'}

同时,hbase shell命令:

create 'ttt', 'd'
disable 'ttt'
alter 'ttt', METHOD => 'table_att', 'coprocessor'=>'hdfs:///my_coprocessor-1.0.jar|com.mycompany.MyCoprocessor|1001|'
enable 'ttt'

会生成一个启用了协处理器的模式:

'ttt', {METHOD => 'table_att', coprocessor$1 => 'hdfs:///my_coprocessor-1.0.jar|com.mycompany.MyCoprocessor|1001|'}, 
       {NAME => 'd', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE',
        MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', 
        IN_MEMORY => 'true', ENCODE_ON_DISK => 'true', BLOCKCACHE => 'true'}

问题:

  • 如何在 hbase_table_ttt.xml 文件中正确注册协处理器?

0 个答案:

没有答案