从HBase迁移到TableStorage
更新时间:2019-06-18
从HBase迁移到TableStorage有以下几项需要注意。
依赖
使用TableStorage,首先需要引入TableStorage相关依赖,具体步骤参见:安装 其中bce-tablestorage-hbase-client依赖了hbase-client 1.2.0版本,如果需要使用其他版本的依赖,可以通过以下方式去除原有依赖:
<dependency>
<groupId>com.baidubce</groupId>
<artifactId>bce-java-sdk</artifactId>
<version>${bce.sdk.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
</exclusion>
</exclusions>
</dependency>
配置
使用TableStorage时,需要在hbase-site.xml中配置endpoint,instance等信息,具体格式如下:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<configuration>
<property>
<name>hbase.client.connection.impl</name>
<value>com.baidubce.services.tablestoragehbaseclient.hbase.TablestorageConnection</value>
</property>
<property>
<name>tablestorage.client.endpoint</name>
<value>tablestorage-endpoint</value>
</property>
<property>
<name>tablestorage.client.instancename</name>
<value>rest</value>
</property>
<property>
<name>tablestorage.client.accesskeyid</name>
<value>your-access-key</value>
</property>
<property>
<name>tablestorage.client.secretaccesskey</name>
<value>your-secret-key</value>
</property>
</configuration>