一、HBase Meta表

hbase:metab表存放着整个集群的所有Region信息,客户端数据的读写需要定位到具体需要操作的Region,说白了就是一张字典表。meta表只会有一个Region,这是为了确保meta表多次操作的原子性。

二、Meta表结构与内容

scan 'hbase:meta'
ROW  COLUMN+CELL
hbase:namespace column=table:state, timestamp=1625022648593, value=\x08\x00
hbase:namespace,,1625022647862.882bc9caea6a5cee511a1525d7801f06. column=info:regioninfo, timestamp=1625037742467, value={ENCODED => 882bc9caea6a5cee511a1525d7801f06, NAME => 'hbase:namespace,,1625022647862.882bc9caea6a5cee511a1525d7801f06.', STARTKEY => '', ENDKEY => ''}
hbase:namespace,,1625022647862.882bc9caea6a5cee511a1525d7801f06. column=info:seqnumDuringOpen, timestamp=1625037742467, value=\x00\x00\x00\x00\x00\x00\x00\x0A
hbase:namespace,,1625022647862.882bc9caea6a5cee511a1525d7801f06. column=info:server, timestamp=1625037742467, value=10.2.31.104:16020
hbase:namespace,,1625022647862.882bc9caea6a5cee511a1525d7801f06. column=info:serverstartcode, timestamp=1625037742467, value=1625037620770
hbase:namespace,,1625022647862.882bc9caea6a5cee511a1525d7801f06. column=info:sn, timestamp=1625037742238, value=10.2.31.104,16020,1625037620770
hbase:namespace,,1625022647862.882bc9caea6a5cee511a1525d7801f06. column=info:state, timestamp=1625037742467, value=OPEN
 
search_table column=table:state, timestamp=1625037955888, value=\x08\x00
search_table,,1625037955174.f507364ab62a42cfe702c6b3dea8757c. column=info:regioninfo, timestamp=1625037955882, value={ENCODED => f507364ab62a42cfe702c6b3dea8757c, NAME => 'search_table,,1625037955174.f507364ab62a42cfe702c6b3dea8757c.', STARTKEY => '', ENDKEY => ''}
search_table,,1625037955174.f507364ab62a42cfe702c6b3dea8757c. column=info:seqnumDuringOpen, timestamp=1625037955882, value=\x00\x00\x00\x00\x00\x00\x00\x02
search_table,,1625037955174.f507364ab62a42cfe702c6b3dea8757c. column=info:server, timestamp=1625037955882, value=10.2.31.104:16020
search_table,,1625037955174.f507364ab62a42cfe702c6b3dea8757c. column=info:serverstartcode, timestamp=1625037955882, value=1625037620770
search_table,,1625037955174.f507364ab62a42cfe702c6b3dea8757c. column=info:sn, timestamp=1625037955648, value=10.2.31.104,16020,1625037620770
search_table,,1625037955174.f507364ab62a42cfe702c6b3dea8757c. column=info:state, timestamp=1625037955882, value=OPEN

三、Meta表组成说明

3.1 Rowkey组成
meta表中的一个Rowkey就代表了一个region。Rowkey主要由以下几部分组成:

3.1.1.TableName(业务表名)
3.1.2.StartRow(业务表Region区间的起始rowkey)
3.1.3.Timestamp(Region创建的时间戳)
3.1.4.EncodedName(上面3个字段的MD5 Hex值)4个字段拼接而成

StartRow为空的,说明这是该table的第一个region。若对应region中startkey和endkey都为空的话,表明这个table只有一个region

Rowkey:search_table,,1625037955174.f507364ab62a42cfe702c6b3dea8757c.
TableName: search_table为表名称。
StartRow: StartRow缺失
Timestamp: 1625037955174
EncodedName: 1625037955174.f507364ab62a42cfe702c6b3dea8757c.
3.2 Column组成
每一行数据又分为6列,不同版本列个数不一样,主要列为以下四个:

3.2.1 info:regioninfo

Value主要存储4个信息,即EncodedName、RegionName、Region的StartRow、Region的StopRow
```
{ENCODED => f507364ab62a42cfe702c6b3dea8757c, NAME => 'search_table,,1625037955174.f507364ab62a42cfe702c6b3dea8757c.', STARTKEY => '', ENDKEY => ''}
```

3.2.2 info:seqnumDuringOpen

Value主要存储Region打开时的sequenceId
```
\x00\x00\x00\x00\x00\x00\x00\x02
```

3.2.3 info:server

Value主要存储Region落在哪个RegionServer上
```
10.2.31.104:16020
```

3.2.4 info:serverstartcode

Value主要存储所在RegionServer的启动Timestamp
```
1625037620770
```


靖锅锅
1 声望1 粉丝

什么也不想说


引用和评论

0 条评论