edit-icon download-icon

Migrate from HBase to Table Store

Last Updated: Mar 16, 2018

The following information explains how to migrate HBase to Table Store.

Dependencies

TableStore HBase Client v1.2.0 depends on HBase Client v1.2.0 and TableStore Java SDK v4.2.1. The configuration of pom.xml is as follows.

  1. <dependencies>
  2. <dependency>
  3. <groupId>com.aliyun.openservices</groupId>
  4. <artifactId>tablestore-hbase-client</artifactId>
  5. <version>1.2.0</version>
  6. </dependency>
  7. </dependencies>

If you want to use another HBase Client or Table Store Java SDK version, you must use the exclusion tag. In the following example, HBase Client v1.2.1 and Table Store Java SDK v4.2.0 are used.

  1. <dependencies>
  2. <dependency>
  3. <groupId>com.aliyun.openservices</groupId>
  4. <artifactId>tablestore-hbase-client</artifactId>
  5. <version>1.2.0</version>
  6. <exclusions>
  7. <exclusion>
  8. <groupId>com.aliyun.openservices</groupId>
  9. <artifactId>tablestore</artifactId>
  10. </exclusion>
  11. <exclusion>
  12. <groupId>org.apache.hbase</groupId>
  13. <artifactId>hbase-client</artifactId>
  14. </exclusion>
  15. </exclusions>
  16. </dependency>
  17. <dependency>
  18. <groupId>org.apache.hbase</groupId>
  19. <artifactId>hbase-client</artifactId>
  20. <version>1.2.1</version>
  21. </dependency>
  22. <dependency>
  23. <groupId>com.aliyun.openservices</groupId>
  24. <artifactId>tablestore</artifactId>
  25. <classifier>jar-with-dependencies</classifier>
  26. <version>4.2.0</version>
  27. </dependency>
  28. </dependencies>

TableStore HBase Client v1.2.x is only compatible with HBase Client v1.2.x, because API changes exist in HBase Client v1.2.x and earlier.

  • If you want to use HBase Client version v1.1.x, use TableStore HBase Client version v1.1.x.

  • If you want to use HBase Client version v0.x.x, see Migrate HBase of an earlier version.

Configure the file

To migrate data from HBase Client to TableStore HBase Client, modify the following two items in the configuration file.

HBase Connection type

Set Connection to TableStoreConnection.

  1. <property>
  2. <name>hbase.client.connection.impl</name>
  3. <value>com.alicloud.tablestore.hbase.TablestoreConnection</value>
  4. </property>

Configuration items of Table Store

Table Store offers strict permission management. To access Table Store, you must configure access information such as the AccessKey.

  • Before accessing Table Store, you must configure the following four items.

    1. <property>
    2. <name>tablestore.client.endpoint</name>
    3. <value></value>
    4. </property>
    5. <property>
    6. <name>tablestore.client.instancename</name>
    7. <value></value>
    8. </property>
    9. <property>
    10. <name>tablestore.client.accesskeyid</name>
    11. <value></value>
    12. </property>
    13. <property>
    14. <name>tablestore.client.accesskeysecret</name>
    15. <value></value>
    16. </property>
  • Optional items you can configure are as follows.

    1. <property>
    2. <name>hbase.client.tablestore.family</name>
    3. <value>f1</value>
    4. </property>
    5. <property>
    6. <name>hbase.client.tablestore.family.$tablename</name>
    7. <value>f2</value>
    8. </property>
    9. <property>
    10. <name>tablestore.client.max.connections</name>
    11. <value>300</value>
    12. </property>
    13. <property>
    14. <name>tablestore.client.socket.timeout</name>
    15. <value>15000</value>
    16. </property>
    17. <property>
    18. <name>tablestore.client.connection.timeout</name>
    19. <value>15000</value>
    20. </property>
    21. <property>
    22. <name>tablestore.client.operation.timeout</name>
    23. <value>2147483647</value>
    24. </property>
    25. <property>
    26. <name>tablestore.client.retries</name>
    27. <value>3</value>
    28. </property>
    • hbase.client.tablestore.family and hbase.client.tablestore.family.$tablename

      • Table Store only supports single ColumnFamilies. When you use HBase APIs, you must enter the content of the family.

      • hbase.client.tablestore.family indicates global configuration, while hbase.client.tablestore.family.$tablename indicates configuration of a single table.

      • Rule: For tables whose names are T, search for hbase.client.tablestore.family.T first. If the family does not exist, search for hbase.client.tablestore.family. If the family does not exist, use the default value f.

    • tablestore.client.max.connections

      • Maximum connections. The default value is 300.
    • tablestore.client.socket.timeout

      • Socket time-out time. The default value is 15 seconds.
    • tablestore.client.connection.timeout

      • Connection time-out time. The default value is 15 seconds.
    • tablestore.client.operation.timeout

      • API time-out time. The default value is Integer.MAX_VALUE, indicating that the API never times out.
    • tablestore.client.retries

      • Number of retries when a request fails. The default value is 3.
Thank you! We've received your feedback.