关于hbase:HBase-Meta表结构组成

46次阅读

共计 3052 个字符,预计需要花费 8 分钟才能阅读完成。

一、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 个字段拼接而成

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
```

正文完
 0