Updated on 2022-12-09 GMT+08:00

Implementing Custom RowKeys

Scenario

Implement custom RowKeys. You can compile RowKey implementation code and import combined RowKeys based on the code logic.

Configuration Method

  1. When you compile the implementation class of a custom RowKey, inherit the interface. The JAR file path of the interface is Client installation directory/HBase/hbase/lib/hbase-it-bulk-load-*.jar.

    [com.huawei.hadoop.hbase.tools.bulkload.RowkeyHandlerInterface],

    Interface implementation method:

    byte[] getRowkeyBytes(String[] colsValues, RegulationDomain regulation)

    Where

    • colsValues indicates a collection of one original data row. Each element is a column.
    • regulation indicates information about the configuration file to be imported. (Typically, this parameter is not used.)

  2. Compress the implementation class and its dependent package into a JAR file, save the file to any location on the node where the HBase client resides, and ensure that the user who executes the command has the permission to read and execute the JAR file.
  3. When you run the import command, add the following two configuration items:

    -Dimport.rowkey.jar=Full path of the JAR file in step 2

    -Dimport.rowkey.class=Full class name of the user implementation class