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