HBase Read Path
caching maxResultSize AllowPartialScanResultCache Cell-1 Cell-2 RowKey-1 Cell-3 Cell-4 RowKey-2 Cell-5 RowKey-3 Cell-7 RowKey-4 Cell-6 Cell-8 Cell-9 Cell-1 Result-1 Cell-4 Result-3 Cell-5 Result-4 limit Caching maxResultSize CompleteScanResultCache Cell-1 Cell-2 RowKey-1 Cell-3 Cell-4 RowKey-2 Cell-5 RowKey-3 Cell-7 RowKey-4 Cell-6 Cell-8 Cell-9 Cell-1 Result-1 Cell-4 Result-3 Cell-5 Result-4 limit Caching Caching Caching BatchScanResultCache Cell-1 Cell-2 RowKey-1 Cell-3 Cell-4 RowKey-2 Cell-5 RowKey-3 Cell-7 RowKey-4 Cell-6 Cell-8 Cell-9 Cell-1 Result-1 Cell-4 Result-3 Cell-5 Result-40 码力 | 38 页 | 970.76 KB | 1 年前3HBase基本介绍
都可以有多个版本的值, 我没有画出来. 版本⽤用时间戳表示. • 整个table都是按rowkey排序存储的 • 按rowkey⽤用LSM树做了了索引, 没有其他⼆二级 索引 • 所以只有按rowkey查询⽐比较快, 其他全表扫 • 除了了列列族要求是可打印字符, 别的都可以是任 意⼆二进制数据 数据模型 RowKey • ColumnFamily的设计是要求把相关的列列放在 同族 • ⽤用⼀一句句话总结物理理视图, 就是伪装起来的KV存储 这⾥里里我想了了好久如何给⼤大家讲HBase数据模型的物理理视图 数据模型 物理理视图 数据模型 物理理视图 或者换⼀一个⽅方式来看 • 设备id作为rowkey • ⽇日志时间作为version时间 • 其余作为10列列 1个ID, 100条⾏行行为(100个版本), 10列列 = 1000个KV对: id存了了1000次, 时间存了了1000次 就要有node. 如图可以看出RegionServer和Datanode尽量量在同⼀一台机器器上. • ⽔水平 按rowkey分开 region • Pre-split: 0-5 6-10 • Auto-split: size • 垂直 按CF分开 系统组成 Region ⽔水平按rowkey分. 这个分两步, 第⼀一个是在建表的时候指定分的⽅方式. ⽐比如两个split, 0-5 6-100 码力 | 33 页 | 4.86 MB | 1 年前3HBase Practice At XiaoMi
ID in hbase:meta ○ WAL Entry only has an encoded region name, but rowkey in hbase:meta is a full region name, the two different rowkey format messed up the hbase:meta. ○ Inconsistent between WAL position(ZK) Last Pushed Seq ID (Region) WAL-Position Original Design New Design RowKey: Encoded Region Name RowKey: Encoded Region Name RowKey: Full Region Name Why to reimplement the serial replication #1 ➢ ID in hbase:meta ○ WAL Entry only has an encoded region name, but rowkey in hbase:meta is a full region name, the two different rowkey format messed up the hbase:meta. ○ Inconsistent between WAL position(ZK)0 码力 | 56 页 | 350.38 KB | 1 年前3HBase最佳实践及优化
Postgres Conference China 2016 中国用户大会 HBase现存缺点 • SQL(传统BI)不友好,不支持很多传统DBMS 功能,如外键,约束… • 数据无类型 • 非RowKey查询性能差 • Column Family限制(数目,Partition对齐) • Region资源消耗大,实例数目不能太多 • 无法保证服务质量* – Split/Compaction等操作对集群性能影响极大 Conference China 2016 中国用户大会 HBase表结构逻辑图 22 Postgres Conference China 2016 中国用户大会 HBase基础 • 表记录按RowKey字典序存储 • 表Schema只定义到Column Family级别属性 – 每个Column Family可以有任意多个Column – 每个Column有可以有任意多个版本(version)的数据 Conference China 2016 中国用户大会 Key粒度及性能 25 Postgres Conference China 2016 中国用户大会 Key对数据查询的影响 • 使用RowKey进行查询的性能最好 • 指定Timestamp能减少store file级别的读操 作 – Bloom Filter也能达到同样目的 • 选择指定的Column Family可以减少查询需0 码力 | 45 页 | 4.33 MB | 1 年前3FISCO BCOS 1.3 中文文档
Hbase数据模型 HBase 以表的形式存储数据。表由行和列组成。列划分为若干个列族(row family),如下图所示。 Rowkey的概念和mysql中的主键是完全一样的,Hbase使用Rowkey来唯一的区 分某一行的数据。每个Region负责一小部分Rowkey范围的数据的读写和维 护,Region包含了对应的起始行到结束行的所有信息。master将对应的region分 配给不同的Rer 供Region的读写服务和相关的管 理工作。 Hbase只支持3中查询方式: 1. 基于Rowkey的单行查询; 2. 基于Rowkey的范围扫描 3. 全表扫描 Hbase分片基础的Region Region的概念和关系型数据库的分区或者分片差不多。 Hbase会将一个大表的 数据基于Rowkey的不同范围分配到不通的Region中,每个Region负责一定范围 的数据访问和存储。这样即 但是无法满足我们对于 随机查询的需求。在HBase中,只有一个单一的按照字典序排序的rowKey索 引,当使用rowKey来进行数据查询的时候速度较快,但是如果不使用rowKey 来查询的话就会使用filter来对全表进行扫描,很大程度上降低了检索性能。而 Phoenix提供了二级索引技术来应对这种使用rowKey之外的条件进行检索的场 景。 Phoenix架构 主要特性: 1. 二级索引 20 码力 | 491 页 | 5.72 MB | 1 年前3电商消息系统架构演进&mdash
4�������� �� ��� ����������� ���������� IM�� ���� ��/��� ����� IM���� ����������DataType���� RowKey=��+��+dataType syncId�� syncBody ���� ������� ���� syncId ��������������� ����syncId��������0 码力 | 22 页 | 12.22 MB | 1 年前3百度超级链 XuperChain 3.7 中文文档
me,desc 1.1.6.2. 初始化表格 1 2 // 定义表格的主键,表格的索引 struct entity: public anchor::Entity { DEFINE_ROWKEY(name); 3 4 5 6 7 8 9 10 DEFINE_INDEX_BEGIN(2) DEFINE_INDEX_ADD(0, id, name) DEFINE_INDEX_ADD(10 码力 | 270 页 | 24.86 MB | 1 年前3百度超级链 XuperChain 3.12-a中文文档
table名称为Entity,属性分别为id,name,desc 初始化表格 1 2 3 // 定义表格的主键,表格的索引 struct entity: public anchor::Entity { DEFINE_ROWKEY(name); 4 5 6 7 8 9 10 DEFINE_INDEX_BEGIN(2) DEFINE_INDEX_ADD(0, id, name) DEFINE_INDEX_ADD(10 码力 | 336 页 | 12.62 MB | 1 年前3百度超级链 XuperChain 3.12-c 中文文档
table名称为Entity,属性分别为id,name,desc 初始化表格 1 2 3 // 定义表格的主键,表格的索引 struct entity: public anchor::Entity { DEFINE_ROWKEY(name); 4 5 6 7 8 9 10 DEFINE_INDEX_BEGIN(2) DEFINE_INDEX_ADD(0, id, name) DEFINE_INDEX_ADD(10 码力 | 336 页 | 12.62 MB | 1 年前3百度超级链 XuperChain 3.12 中文文档
table名称为Entity,属性分别为id,name,desc 初始化表格 1 2 3 // 定义表格的主键,表格的索引 struct entity: public anchor::Entity { DEFINE_ROWKEY(name); 4 5 6 7 8 9 10 DEFINE_INDEX_BEGIN(2) DEFINE_INDEX_ADD(0, id, name) DEFINE_INDEX_ADD(10 码力 | 336 页 | 12.62 MB | 1 年前3
共 18 条
- 1
- 2