1

我在通过 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文件中正确注册协处理器?
4

0 回答 0