正文
hbase两个region,hbaseregionserverhandlercount
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
Hbase扩容原理
1、Storefile的合并,storefile 的数量达到阈值后,会进行合并。
2、在Region里面管理的Store管理的是列族,Store里面有Mem Store(内存),Flush之后,删除内存中的数据,同时写入文件StoreFile Hfile,Hfile 其实是在DataNode里面的。 Hbase的读比写慢。 Hbase命名空间下有一张元数据表meta表和namespace表。
3、RegionServer出现故障的处理原理是定时向Zookeeper汇报心跳,如果一旦时 间内未出现心跳HMaster将该RegionServer上的Region重新分配到其他RegionServer上。失效服务器上“预写”日志由主服务器进行分割并派送给新的 RegionServer 。
4、有赞技术团队对于HBase高可用服务接口的设计,同样使用了熔断的概念,只是其底层的熔断技术依赖于java微服务中的Hystrix框架。
5、MSLAB的工作原理如下: 在MemStore初始化时,创建MemStoreLAB对象allocator。 创建一个2M大小的Chunk数组,偏移量起始设置为0。Chunk的大小可以通过参数hbase.hregion.memstore.mslab.chunksize调整。
Hbase分区
partition 顾名思义就是分区式,这种分区有点类似于 mapreduce 中的 partitioner,将区域用长整数作为分区号,每个 Region 管理着相应的区域数据,在 RowKey 生成时,将 id 取模后,然后拼上 id 整体作为 RowKey 。
具体步骤如下:需要知道要查询的表名和分区的起始行键或结束行键。可以使用scan命令来扫描hbase:meta表,这个表存储了所有分区的元数据信息。可以使用PrefixFilter或RowFilter来过滤出要查询的分区的记录。
像这样预先创建hbase表分区的方式,称之为预分区。hash(主键) + 年月日时(2019062315)这里只取hash(主键)的前6位,使得行键的长度正好是16,也就是8的整数倍,在64位计算机中,效果最好。
hbase预分区与region切割的关系
1、hbase.hregion.max.filesize 设定的region大小,超过了就会split,就会增加一个region,对预分区没什么影响。
2、默认,HBase 在创建表的时候,会自动为表分配一个 Region,正处于混沌时期,start-end key 无边界,所有 RowKey 都往这个 Region里分配。
3、HBase表的列族在创建之初只有一个Region,随着插入数据的增多Region变得越来越大。
4、以fileServer为例,在使用默认的split策略--IncreasingToUpperBoundRegionSplitPolicy 的情况下,16个预分区Region, 则单个Resion容量达到 min(32,50),即32GB时分裂。
HBase从入门到精通11:HBase数据保存过程和Region分裂
HBase保存数据的流程有以下几个步骤:HBase表的列族在创建之初只有一个Region,随着插入数据的增多Region变得越来越大。
以fileServer为例,在使用默认的split策略--IncreasingToUpperBoundRegionSplitPolicy 的情况下,16个预分区Region, 则单个Resion容量达到 min(32,50),即32GB时分裂。
默认,HBase 在创建表的时候,会自动为表分配一个 Region,正处于混沌时期,start-end key 无边界,所有 RowKey 都往这个 Region里分配。
Hbase Split 是一个很重要的功能,HBase 通过把数据分配到一定数量的 Region 来达到负载均衡的。
由于在HBase中数据存储是Key-Value形式,若向HBase中同一张表插入相同RowKey的数据,则原先存在的数据会被新的数据覆盖。设计的RowKey应均匀的分布在各个HBase节点上, 避免数据热点现象。
可以看出-ROOT-表存储在 dchbase3 机器中,对应界面如下:以上就是HBase客户端根据指定的rowkey从zookeeper开始找到对应的数据的过程。
hbase中什么是Region,什么是RegionServer
regionServer 其实是hbase的服务,部署在一台物理服务器上,region有一点像关系型数据的分区,数据存放在region中,当然region下面还有很多结构,确切来说数据存放在memstore和hfile中。
在Hbase中,slave也被称作RegionServer,每个RegionServer负责管理一些Region,同时一个Region只能属于一个RegionServer。一个RegionServer可以服务一个或多个Region,每个Region在Region Server启动的时候被分配。
HBase中,表会被划分为1…n个Region,被托管在RegionServer中。
RegionServer 拆分 Region的步骤是:先将该 Region 下线,然后拆分,将其子 Region 加入到 META 元信息中,再将他们加入到原本的 RegionServer 中,最后汇报 Master。 执行split 的线程是 CompactSplitThread。
关于hbase两个region和hbaseregionserverhandlercount的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。