`
书音棋
  • 浏览: 142308 次
  • 性别: Icon_minigender_1
  • 来自: 哈尔滨
社区版块
存档分类
最新评论

HBase Merging Regions

阅读更多

我承认我之前不知道hbase还能做merge region操作,而且它适合在什么情况下用呢,下面的这篇文章给出了一些结论:

有的时候region个数太多不是什么好事情,所以merge region大势所趋啦~ 

 

While it is much more common for regions to split automatically over time as you are adding data to the corresponding table, there might be situations where you need to merge regions, for example, after you have removed a large amount of data and you want to reduce the number of regions hosted by each server.

HBase ships with a tool that allows you to merge two adjacent regions as long as the cluster is not online. You can use the command line tool to get the usage details:

 

[html] view plaincopy
  1. $ ./bin/hbase org.apache.hadoop.hbase.util.Merge  
  2. Usage: bin/hbase merge <table-name> <region-1> <region-2>  

 

Here is an example of a table that has more than one region, which are then subsequently merged:

 

[html] view plaincopy
  1. $ ./bin/hbase shell  
  2.   
  3. hbase(main):001:0> create 'testtable', 'colfam1', \  
  4.  {SPLITS => ['row-10','row-20','row-30','row-40','row-50']}  
  5. 0 row(s) in 0.2640 seconds  
  6.   
  7. hbase(main):002:0> for i in '0'..'9' do for j in '0'..'9' do \  
  8.  put 'testtable', "row-#{i}#{j}", "colfam1:#{j}", "#{j}" end end  
  9. 0 row(s) in 1.0450 seconds  
  10.   
  11. hbase(main):003:0> flush 'testtable'  
  12. 0 row(s) in 0.2000 seconds  
  13.   
  14. hbase(main):004:0> scan '.META.', { COLUMNS => ['info:regioninfo']}  
  15. ROW                                  COLUMN+CELL  
  16.  testtable,,1309614509037.612d1e0112 column=info:regioninfo, timestamp=130...  
  17.  406e6c2bb482eeaec57322.             STARTKEY => '', ENDKEY => 'row-10'  
  18.  testtable,row-10,1309614509040.2fba column=info:regioninfo, timestamp=130...  
  19.  fcc9bc6afac94c465ce5dcabc5d1.       STARTKEY => 'row-10', ENDKEY => 'row-20'  
  20.  testtable,row-20,1309614509041.e7c1 column=info:regioninfo, timestamp=130...  
  21.  6267eb30e147e5d988c63d40f982.       STARTKEY => 'row-20', ENDKEY => 'row-30'  
  22.  testtable,row-30,1309614509041.a9cd column=info:regioninfo, timestamp=130...  
  23.  e1cbc7d1a21b1aca2ac7fda30ad8.       STARTKEY => 'row-30', ENDKEY => 'row-40'  
  24.  testtable,row-40,1309614509041.d458 column=info:regioninfo, timestamp=130...  
  25.  236feae097efcf33477e7acc51d4.       STARTKEY => 'row-40', ENDKEY => 'row-50'  
  26.  testtable,row-50,1309614509041.74a5 column=info:regioninfo, timestamp=130...  
  27.  7dc7e3e9602d9229b15d4c0357d1.       STARTKEY => 'row-50', ENDKEY => ''  
  28. 6 row(s) in 0.0440 seconds  
  29.   
  30. hbase(main):005:0> exit  
  31.   
  32. $ ./bin/stop-hbase.sh  
  33.   
  34. $ ./bin/hbase org.apache.hadoop.hbase.util.Merge testtable \  
  35.  testtable,row-20,1309614509041.e7c16267eb30e147e5d988c63d40f982. \  
  36.  testtable,row-30,1309614509041.a9cde1cbc7d1a21b1aca2ac7fda30ad8.  



 

The example creates a table with five split points, resulting in six regions. It then inserts some rows and flushes the data to ensure that there are store files for the subsequent merge. The scan is used to get the names of the regions, but you can also use the web UI of the master: click on the table name in the User Tables section to get the same list of regions.

Note

Note how the shell wraps the values in each column. The region name is split over two lines, which you need to copy&paste separately. The web UI is easier to use in that respect as it has the names in one column and in a single line.

The content of the column values is abbreviated to the start and end keys. You can see how the createcommand using the split keys has created the regions. The example goes on to exit the shell, and stop the HBase cluster. Note that HDFS still needs to run for the merge to work as it needs to read the store files of each region and merge them into a new combined one.

分享到:
评论

相关推荐

    hbase regions数据切割.docx

    介绍hbase regions进行数据切割

    HbaseTemplate 操作hbase

    java 利用 sping-data-hadoop HbaseTemplate 操作hbase find get execute 等方法 可以直接运行

    pinpoint的hbase初始化脚本hbase-create.hbase

    搭建pinpoint需要的hbase初始化脚本hbase-create.hbase

    HBase数据库设计.doc

    1. HBase有哪些基本的特征? 1 HBase特征: 1 2. HBase相对于关系数据库能解决的问题是什么? 2 HBase与关系数据的区别? 2 HBase与RDBMS的区别? 2 3. HBase的数据模式是怎么样的?即有哪些元素?如何存储?等 3 1...

    HBase(hbase-2.4.9-bin.tar.gz)

    HBase(hbase-2.4.9-bin.tar.gz)是一个分布式的、面向列的开源数据库,该技术来源于 Fay Chang 所撰写的Google论文“Bigtable:一个结构化数据的分布式存储系统”。就像Bigtable利用了Google文件系统(File System...

    hbase-sdk是基于hbase-client和hbase-thrift的原生API封装的一款轻量级的HBase ORM框架

    hbase-sdk是基于hbase-client和hbase-thrift的原生API封装的一款轻量级的HBase ORM框架。 针对HBase各版本API(1.x~2.x)间的差异,在其上剥离出了一层统一的抽象。并提供了以类SQL的方式来读写HBase表中的数据。对...

    Hbase资源整理集合

    HBase 官方文档.pdf HBase的操作和编程.pdf HBase Cpressr优化与实验 郭磊涛.pdf null【HBase】Data Migratin frm Gri t Clu Cmputing - Natural Sienes .pdf 分布式数据库HBase快照的设计与实现.pdf 【HBase】...

    HBase学习利器:HBase实战

    HBase开发实战,HBase学习利器:HBase实战

    java大数据作业_3HBase

    1. 请用java集合的代码描述HBase的表结构 2. 请简述HBase中数据写入最后导致Region分裂的全过程 3. 如果设计一个笔记的表,表中要求有笔记的属性和笔记的内容,怎么做 4. HBase部署时如何指定多个zookeeper 5. HBase...

    HBase开启审计日志

    HBase开启审计日志

    hbase-2.3.5单机一键部署工具

    注意:zookeeper3.4.13和hbase2.3.5都是采用docker-compose方式部署 原文链接:https://blog.csdn.net/m0_37814112/article/details/120915194 说明:使用外部zookeeper3.4.13之hbase2.3.5一键部署工具,支持部署、...

    实验三:熟悉常用的HBase操作

    A.3实验三:熟悉常用的HBase操作 本实验对应第5章的内容。 A.3.1 实验目的 (1)理解HBase在Hadoop体系结构中的角色。(2)熟练使用HBase操作常用的 Shell命令。(3)熟悉HBase操作常用的 Java API。 A.3.2 实验平台 (1...

    hbase资料api

    HBASE

    Architecting_HBase_Applications_201608

    不多说,上目录。 Preface 1.What Is HBase? 2.HBase Principles ...14.Too Many Regions 15.Too Many Column Families 16.Hotspotting 17.Timeouts and Garbage Collection 18.HBCK and Inconsistencies Index

    HBase3.0参考指南

    HBase3.0参考指南 This is the official reference guide for the HBase version it ships with. Herein you will find either the definitive documentation on an HBase topic as of its standing when the ...

    hbase 资源合集 hbase 企业应用开发实战 权威指南 hbase 实战 hbase 应用架构

    hbase 资源合集 hbase 企业应用开发实战 权威指南 hbase 实战 hbase 应用架构

    HBase海量数据存储实战视频教程

    从HBase的集群搭建、HBaseshell操作、java编程、架构、原理、涉及的数据结构,并且结合陌陌海量消息存储案例来讲解实战HBase 课程亮点 1,知识体系完备,从小白到大神各阶段读者均能学有所获。 2,生动形象,化繁为...

    Hbase权威指南(HBase: The Definitive Guide)

    如果你正在寻找一种具备可伸缩性的存储解决方案来适应几乎没有穷尽的数据的话,这本书将可以向你表明apache hbase完全能够满足你的需求。作为google bigtable架构的开源实现,hbase能够支持数以十亿计的记录数和数以...

    HBase的图形化管理工具/Hbase的GUI工具

    由于网上下的不支持最新的hadoop,hbase 版本自己稍微修改了下,支持最新版本HBase的图形化管理工具,目前修改改为hadoop-2.7.1版本,hbase-1.1.2版本,依赖可以自己切换,源代码已经包括再里边了,如想修改直接修改...

    大数据开发之Hbase基本使用及存储设计实战教程(视频+笔记+代码)

    │ Day15[Hbase 基本使用及存储设计].pdf │ ├─02_视频 │ Day1501_Hbase的介绍及其发展.mp4 │ Day1502_Hbase中的特殊概念.mp4 │ Day1503_Hbase与MYSQL的存储比较.mp4 │ Day1504_Hbase部署环境准备.mp4 │ Day...

Global site tag (gtag.js) - Google Analytics