Catlog table
Catelog Table
Catlog is essentially an HBase table and just like other table but is filled out of the HBase Shell's list command .
Hbase: meta
-
Hbase:meta 表属于系统表。
-
Meta表保存了HBase系统中所有Region列表,存储在某个RegionServer上,meta表的地址信息存储在Zookeeper中 /hbase 路径下的 meta-region-server 节点。
-
Hbase:meta 表结构:
Row Key:
-
Region key of the format (
[table],[region start key],[region id]
)。Table : tableName.
Region start key : region的第一个Rowkey,在HRegionInfo中.
Region id: Regionid由该Region生成时的时间戳精确到毫秒值与Region encode 组成,而Region encode 由该region所在的表名、StartKey、时间戳这三者的MD5值产生。
Note:
1.HBase在hdfs上的存储region的路径就是region encode。
2.Key被用来表示Region Name。
3.Meta表中startkey靠前的会排在starkey靠后的前面。
Values:
info:regioninfo
(serialized HRegionInfo instance for this region)info:server
(server:port of the RegionServer containing this region)info:serverstartcode
(start-time of the RegionServer process containing this region)。
Note on HRegionInfo:
The empty key is used to denote table start and table end. A region with an empty start key is the first region in a table. If a region has both an empty start and an empty end key, it is the only region in the table.
- HBase 2.X
在HBase2.x的版本中,meta表有了一些变化,Column Family中增加了state、sn两个Column。
Info:state :Region状态
Info:sn :Region Server Node,由 server 和 serverstartcode 组成。
其他字段不变。
Region Split impact on meta
- 当不断向一个table写数据,会触发region spilt,而split过程会对meta表产生一定的影响。
Note:When a table is in the process of splitting, two other columns will be created, called info:splitA
and info:splitB
. These columns represent the two daughter regions. The values for these columns are also serialized HRegionInfo instances. After the region has been split, eventually this row will be deleted.
-
更新meta表中parent region的info:regionfo列的值,增加info:splitA
and
info:splitB。 -
将child region相关信息插入meta表,top child region的startkey 和parent region 的startkey 一样,此时region id 就会起作用了,通过timestamp作为region的id来区分,top region od 取 timestamp+1,这样就可以抱着child region总排在parent region的前面。
Note:bottom child必须先插入到meta表中才能插入top child ,否则会在meta表中出现bottom region里的key找不到对应region的情况。