前提说明:本文章研究的hbase版本是0.94.12。.
-ROOT-表和.META.表是hbase的元数据表,在-ROOT-表中保存有.META.表的相关信息,在.META.表中保存有业务表的region相关信息,在client端访问具体的业务表的region时需要先通过-ROOT-表找到.META.表,再通过.META.表找到region的位置,即这两个表主要解决了region的快速路由问题。
通过scan命令查看-ROOT-表的数据:
通过上图可以看出-ROOT-表的1行记录共有1个列簇4个列:regioninfo、server、serverstartcode、v,分别介绍如下:
1、regioninfo列
该列包含了.META.表的region信息:region名称、开始rowkey、结束rowkey、encode值:
a)region名称的组成规则:表名称+”,”+startKey+”,”+regionId,regionId的组成规则是:创建region时的时间戳+”.”+encode值(旧版hbase的regionId只有时间戳)+“.”,region名称会被作为-ROOT-表的rowkey,.META.表的rowkey也如此,这种设计可以充分利用hbase的rowkey机制快速定位region。
-ROOT-表中.META. region的regionId比较特殊,.META.表的第一个region没有采用encode码,而是直接指定1,.META.表中业务表的region则完全遵循该规则,如图:
b)startKey,region的开始key,第一个region的startKey是空字符串;
c)endKey,region的结束key,最后一个region的endKey是空字符串;
d)encode值,该值会作为hdfs文件系统的一个目录,如图:
-ROOT-表和.META.表的encode值是固定值,hbase源码如下:
public static String prettyPrint(final String encodedRegionName) { if (encodedRegionName.equals("70236052")) { return encodedRegionName + "/-ROOT-"; } else if (encodedRegionName.equals("1028785192")) { return encodedRegionName + "/.META."; } return encodedRegionName; } |
在hbase的管理界面可以看到-ROOT-表和.META.表的信息:
2、server列:所在regionserver的服务器域名(或者ip)和端口;
3、serverstartcode列:以创建regionserver时的时间戳作为regionserver的startcode,同一个regionserver下的所有region该列值相同,该值作为regionserver的名称的一部分,源代码如下:
public static String getServerName(String hostName, int port, long startcode) { final StringBuilder name = new StringBuilder(hostName.length() + 1 + 5 + 1 + 13); name.append(hostName); name.append(SERVERNAME_SEPARATOR); name.append(port); name.append(SERVERNAME_SEPARATOR); name.append(startcode); return name.toString(); } |
在hbase的管理界面可以看到regionserver的信息:
4、v列,该列是在hbase0.92这个版本开始新增加的列,值是固定的0,主要主用是区别0.92和之前的版本,以便hbase进行版本迁移,源码如下:
/** * The current version of the meta table. * Before this the meta had HTableDescriptor serialized into the HRegionInfo; * i.e. pre-hbase 0.92. There was no META_VERSION column in the root table * in this case. The presence of a version and its value being zero indicates * meta is up-to-date. */ public static final short META_VERSION = 0;
// Update meta with new HRI if required. i.e migrate all HRI with HTD to // HRI with out HTD in meta and update the status in ROOT. This must happen // before we assign all user regions or else the assignment will fail. // TODO: Remove this when we do 0.94. org.apache.hadoop.hbase.catalog.MetaMigrationRemovingHTD. updateMetaWithNewHRI(this); //注:HTD指:HTableDescriptor, HRI指:HRegionInfo
public static final byte [] META_VERSION_QUALIFIER = Bytes.toBytes("v");
//Current meta table version or -1 if no version found. static short getMetaVersion(final Result r) { byte [] value = r.getValue(HConstants.CATALOG_FAMILY, HConstants.META_VERSION_QUALIFIER); return value == null || value.length <= 0? -1: Bytes.toShort(value); }
|
最后需要说明的是:-ROOT-表只存在一个region里,该region不会分裂成多个region ,因为-ROOT-表只保存.META.表的region信息,而.META.表的region理论上不会太多,.META.表可以有多个region,-ROOT-表和.META.表的每一行均描述一个region的信息。
相关推荐
[root@haoc2008 data]# rpm -ivh xorg-x11-deprecated-libs-6.8.2-1.EL.13.37.i386.rpm warning: xorg-x11-deprecated-libs-6.8.2-1.EL.13.37.i386.rpm: V3 DSA signature: NOKEY, key ID b38a8516 Preparing......
解压缩后会有两个文件:mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar和mysql8安装说明.txt 1、安装 rpm -i 需要安装的包文件名 举例如下: rpm -i example.rpm 安装 example.rpm 包; rpm -iv example.rpm 安装 ...
389-ds-base-1.3.6.1-28.el7_4.x86_64.rpm 389-ds-base-1.3.6.1-28.el7_4.x86_64.rpm
1、[root@centos kl]# rpm -ivh kernel-ml-headers-5.18.10-1.el7.elrepo.x86_64.rpm -- force --nodeps 2、[root@centos kl]# rpm -ivh kernel-ml-tools-libs-5.18.10-1.el7.elrepo.x86_64.rpm --force --nodeps 3...
给广大开发爱好者一个开发框架:shiro-root-1.4.1-source-release.zip
kernel-3.10.0-957.21.3.el7.x86_64.rpm
-rw-r--r--. 1 root root 4239360 Jun 25 16:54 openssh-9.0p1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 654600 Jun 25 16:51 openssh-clients-9.0p1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 3108976 Jun 25 16...
signed_open-root-20201222(2).deb
三星NOTE2 N7100 网络未注册cwm-root-note2.tar.md5
/root/.swt/lib/linux/x86_64/libswt-mozilla-gtk-4335.so: libxpcom.so: cannot open shared object file: No such file or directory Can't load library: /root/.swt/lib/linux/x86_64/libswt-mozilla-gtk.so ...
phpMyAdmin-4.9.2-all-languages.tar.gz, 中文版本。在项目目录直接解压即可,可以使用root来登录。用来管理数据库,如mysql,mariadb等
若是用fedora8遇到java: xcb_xlib.c:50:xcb_xlib_unlock: 断言“c->xlib.lock”失败,则试试下面办法,我安装JMF时无法初始化,用程序...[root@localhost ~]$ rpm -Uvh --force libX11-devel-1.0.3-8.fc7.i386.rpm
stock-ef17-kernel-root-cwm-v2.tar.rar 三星sph-p100 rooted recovery,
luci-i18n-base-zh-cn_git-22.115.68448-712bc8e-1_all.ipk
已编译 Kafka-Manager-1.3.3.22 linux下直接解压解压kafka-manager-1.3.3.22.zip到/opt/module目录 ...备注:指定端口号看启动过程中 "-Dhttp.port=7456" 端口可以自己设置 http://hadoop102:7456
[root@localhost expect]# yum install --downloadonly --downloaddir=./ expect [root@localhost expect]# ls expect-5.45-14.el7_1.x86_64.rpm [root@localhost expect]# rpm -ivh expect-5.45-14.el7_1.x86_64....
①修改 jar 包中的application.properties,重点是 zookeeper.address、zookeeper.nodeParent、hdfs.root.dir配置项,hdfs 最好写 ip; ②将core-site.xml、hdfs-site.xml添加到BOOT-INF/classes 下; ③开始修复 `...
lede模拟器-openwrt模拟器-malta-mips-be-uClibc.part1.rar,由于文件太大,分成了两个文件上传part1和part2 linux或windows都可以运行,需要安装qemu qemu-system-mips -M malta -hda lede-malta-be-root.ext4 -...
离线安装包,亲测可用
[root@centos bin]# uname -sr Linux 2.6.18-238.12.1.el5 [root@centos bin]# svn --version svn,版本 1.6.17 (r1128011) 编译于 May 29 2011,14:51:01 [root@centos bin]# svn info svn://192.168.105.4 路径:...