出处:http://www.oratea.net
通过HBaseAdmin的move方法可以把Region从一台RegionServer迁移到另外的RegionSever上。这在处理数据热点和grace stop的时候比较有用。
举例如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import
org.apache.hadoop.conf.Configuration;
import
org.apache.hadoop.hbase.HBaseConfiguration;
import
org.apache.hadoop.hbase.MasterNotRunningException;
import
org.apache.hadoop.hbase.UnknownRegionException;
import
org.apache.hadoop.hbase.ZooKeeperConnectionException;
import
org.apache.hadoop.hbase.client.HBaseAdmin;
import
org.apache.hadoop.hbase.util.Bytes;
public
class
test01 {
public
static
void
main(String[] args)
throws
MasterNotRunningException, ZooKeeperConnectionException, UnknownRegionException {
Configuration conf =
null
;
conf = HBaseConfiguration.create();
conf.set(
"hbase.zookeeper.quorum"
,
"192.168.0.159"
);
conf.set(
"hbase.zookeeper.property.clientPort"
,
"2181"
);
HBaseAdmin admin =
new
HBaseAdmin(conf);
admin.move(Bytes.toBytes(
"b01e6ed888395768c58ef350ab0bc785"
), Bytes.toBytes(
"hadoop02,60020,1342601367463"
));
}
}
|
其中需要注意的move方法的两个输入参数:
/**
* Move the region r
to dest
.
* @param encodedRegionName The encoded region name; i.e. the hash that makes
* up the region name suffix: e.g. if regionname is
* TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.
,
* then the encoded region name is: 527db22f95c8a9e0116f0cc13c680396
.
* @param destServerName The servername of the destination regionserver. If
* passed the empty byte array we’ll assign to a random server. A server name
* is made of host, port and startcode. Here is an example:
* host187.example.com,60020,1289493121758
* @throws UnknownRegionException Thrown if we can’t find a region named
* encodedRegionName
* @throws ZooKeeperConnectionException
* @throws MasterNotRunningException
*/
注意:如果move的目标服务器参数为空,那么HBase会随机选择一台机器作为目标的机器
分享到:
相关推荐
hbase基于快照的数据迁移,hbase提供的数据迁移方案。
介绍如何hbase-0.94.1手动进行数据迁移
下面为从自建的数据中心迁移hadoop到华为云上适配大数据平台MRS的一次项目迁移,此项目涉及到hive、kudu、hbase 的数据迁移,数据总量达到了15T,此文档是耗时5月时间和时间的检验,通过脚本编辑批量迁移完成大数据...
关系型数据库与HBASE间的数据迁移介绍.pptx
Hadoop数据迁移--从Hadoop向HBase
1、region 拆分机制 ...当region大小大于某个阈值(hbase.hregion.max.filesize=10G)之后就会触发切分,一个region等分为2个region。 但是在生产线上这种切分策略却有相当大的弊端:切分策略对于大表和小表没有
HBASERegion数量增多问题描述及解决方案.docx
HBASE性能调优方法1
nosql实验五-HBase数据迁移与数据备份&恢复
Hbase 性能 优化,Hbase 数据查询 插入参考
kettle集群搭建以及使用kettle将mysql数据转换为Hbase数据
在eclipse中开发HBase程序的方法
实现一个简单的基于Mysql的表转换成基于HBase的过程,只实现了Dao层的转换,包含实现文件和单元测试文件,简单、易上手,值得初学者使用
Hbase图形化客户端工具,squirrel使用Phoenix连接HBASE附带使用方法,还有hive,pig等jar包
SQL Server数据库到HBase数据库的模式转换和数据迁移研究.pdf
Chapter 16: The HBaseAdmin Class Chapter 17: Using the Get Class Chapter 18: Using the HTable Class Part VI: Administration Chapter 19: Using the HBase Shell Chapter 20: Bulk Loading Data
2. 请简述HBase中数据写入最后导致Region分裂的全过程 3. 如果设计一个笔记的表,表中要求有笔记的属性和笔记的内容,怎么做 4. HBase部署时如何指定多个zookeeper 5. HBase shell是基于哪种JVM运行的语言实现的 6. ...
HBase性能优化方法总结.doc
Hbase图形化客户端工具,squirrel使用Phoenix连接HBASE附带使用方法,和之前的一个part1,一起使用
java 利用 sping-data-hadoop HbaseTemplate 操作hbase find get execute 等方法 可以直接运行