HBase HMaster Architecture

http://blog.zahoor.in/2012/08/hbase-hmaster-architecture/

 

HBase architecture follows the traditional master slave model where you have a master which takes decisions and one or more slaves which does the real task. In HBase, the master is called HMaster  and slaves are called HRegionServers (yes..servers). In this post i will zoom in to HMaster and will detail some of the modules and functionality of HMaster.

 

Lets zoom in to HMaster and discuss different modules present in that.

HMaster and its Components

HMaster and its Components

 

Note: Most of the descriptions are taken from javadocs of HBase project. So all credits goes to the developers who wrote it in the first place.

The above diagram shows the internals of HMaster. I have grouped the modules in to different categories for us to make it a little easy.

1 ) External Interfaces

External Interfaces are responsible for interacting with the external world (Hmaster web site, client, Region Servers and other management utilities like JConsole).

Info Server

Info server is an embedded jetty server instance started by HMaster to answer http requests (default port is 60010). The primary goal is to serve up status information for the server. There are three contexts:

  • “/stacks/” -> points to stack trace
  • “/static/” -> points to common static files (src/hbase-webapps/static)
  • “/” -> the jsp server code from (src/hbase-webapps/<name>)

RPC Server

HBase rpc server module instantiates the configured RPC Engine which is responsible for all the rpc communication that the master does. There are atleast two different RPC Engines in hbase now. One is the good old WritableRPCEngine (Which is the default) and the other one is the ProtocolBufferRPCEngine. Whichever is selected, they maintain 3 different interfaces/protocols to which they respond. In master, the supported protocols are MasterMonitorProtocolMasterAdminProtocol and RegionServerStatusProtocol. More about protocols in my earlier post here.

Hbase RPC Server

HBase RPC Server

 

Master MXBean

 Apart from standard HBase metrics, hbase supports Java Management Extension based metric export. You can use any standard JMX compliant browser like JConsole and can view the metrics. To enable JMX based remote metrics monitoring in hbase follow the instructions here

2 ) Executor Services

A generic executor service abstracts a Event Queue where Events of different types can be posted. The events are handled by their respective Runnable handlers which pick threads from a dedicated thread pool. In order to create a new service, create an instance of this class and then do: instance.startExecutorService(“myService”).  When done call shutdown(). In order to use the service created above, call submit(EventHandler). Register pre- and post- processing listeners by registering your implementation of EventHandler.EventHandlerListener with registerListener(EventHandler.EventType, EventHandler.EventHandlerListener).  Be sure to deregister your listener when done via unregisterListener(EventHandler.EventType). The services mentioned below are instantiated using this generic  executor service. The events and Event handlers are described below for each of the service.

Hbase Executor Service

HBase Executor Service

 

Open Region Service (MASTER_OPEN_REGION)

When the master (i.e. Assignment Manager) detects that a region was successfully opened (through zookeeper watch), it posts a event of type RS_ZK_REGION_OPENED to this service. This event is handled by the event handler OpenRegionHandler().

Close Region Service (MASTER_CLOSE_REGION)

When the master (i,e, Assignment Manager) detects that a region was successfully closed (through a watcher), it posts a event of type RS_ZK_REGION_CLOSED to this service. Also when a region open attempt fails an event of type RS_ZK_REGION_FAILED_OPEN is posted. These events are handled by the event handler ClosedRegionHandler().

Server Operations Service (MASTER_SERVER_OPERATIONS)

Master detects a region split through zookeeper watch and posts RS_ZK_REGION_SPLIT which is handled by SplitRegionHandler. Also when a master needs to expire a region server (which does not host ROOT or META) it posts an event M_SERVER_SHUTDOWN which is handled by an event handler ServerShutdownHandler.

Meta Server Operations Service (MASTER_META_SERVER_OPERATIONS)

when a master needs to expire a region server which hosts ROOT or META, it posts an event M_META_SERVER_SHUTDOWN which is handled by an event handler MetaServerShutdownHandler.

Table Operations Service (MASTER_TABLE_OPERATIONS)

 All the table operations originating from the client is handled in this service. Message like C_M_DELETE_TABLE, CM_DISABLE_TABLE, C_M_ENABLE_TABLE, C_M_MODIFY_TABLE and C_M_CREATE_TABLE are posted from the client and handled by the handler DeleteTableHandler, DisableTableHandler, EnableTableHandler, ModifyTableHandler and CreateTableHandler respectivily.

Executor Service

EventEvent Handler

Threads

(Default)

Master Open Region
RS_ZK_REGION_OPENED
OpenRegionHandler
5
Master Close Region
RS_ZK_REGION_CLOSED
ClosedRegionHandler
5
Master Server Operations
 
RS_ZK_REGION_SPLIT
M_SERVER_SHUTDOWN
SplitRegionHandler
ServerShutdownHandler
3
Master Meta Server Operations
M_META_SERVER_SHUTDOWN
MetaServerShutdownHandler
5
Master Table Operations
 
C_M_DELETE_TABLE C_M_DISABLE_TABLE C_M_ENABLE_TABLE C_M_MODIFY_TABLE C_M_CREATE_TABLE
DeleteTableHandler DisableTableHandler EnableTableHandler ModifyTableHandler CreateTableHandler
1

3 ) Zookeeper System Trackers

Master and RS uses zookeeper to keep track of certain events and happenings in the cluster. In Master, a centralized class called ZookeeperWatcher acts as a proxy for any event tracker which uses zookeeper. All the common things like connection handling, node management and exceptions are handled here. Any tracker which needs the service of this call must register with this class to get notified of any specific event.

Zookeeper Based Trackers

Zookeeper Based Trackers

Active Master Manager

Handles everything on master side related to master election. This is the place where the backup masters block, until the active master fails or the cluster shuts down. Listens and responds to ZooKeeper notifications on the master znode, both nodeCreated and nodeDeleted. Uses a zNode called “master” under the base zNode.

Region Server Tracker

Watches the zNode called “rs” under the base zNode. If any children is added (i.e. if any Region server comes up) or deleted (if any Region server goes down) this class gets notified. The main function of this class is to maintain a active list of online Region Servers. If any region server fails it triggers the serverExpiry procedure.

Draining Server Tracker

Tracks the list of draining region servers via ZK. This class is responsible for watching for changes to the draining servers list.  It handles adds/deletes in the draining RS list and watches each node. If an RS gets deleted from draining list, we call ServerManager#removeServerFromDrainList(ServerName) If an RS gets added to the draining list, we add a watcher to it and call ServerManager#addServerToDrainList(ServerName). Uses the zNode called “draining” under the base zNode.

Catalog Tracker

Tracks the availability of the catalog tables -ROOT and .META. This class is “read-only” in that the locations of the catalog tables cannot be explicitly set.  Instead, ZooKeeper is used to learn of the availability and location of -ROOT. -ROOT is used to learn of the location of .META. If not available in -ROOT, ZooKeeper is used to monitor for a new location of .META..Call  #start() to start up operation.  Call #stop() to interrupt waits and close up shop.

Cluster Status Tracker

Used to monitor the cluster status using the zNode “shutdown”. It just says wether the cluster is up or down for now.

Assignment Manager

Manages and performs region assignment. Monitors ZooKeeper for events related to regions in transition. Handles existing regions in transition during master failover.

Root Region Tracker

 Tracks the root region server location node in zookeeper (zNode is “root-region-server”). Root region location is set by RootLocationEditor usually called out of RegionServerServices. This class has a watcher on the root location and notices changes. Mainly used to know if the root region is available and where is it hosted.

Load Balancer

Makes decisions about the placement and movement of Regions across RegionServers. Cluster-wide load balancing will occur only when there are no regions in transition and according to a fixed period of a time using  #balanceCluster(Map). Inline region placement with {@link #immediateAssignment} can be used when the Master needs to handle closed regions that it currently does not have a destination set for.  This can happen during master failover. On cluster startup, bulk assignment can be used to determine locations for all Regions in a cluster. This classes produces plans for the {@link AssignmentManager} to execute. The load balancer implementation are pluggable. By default it uses the “DefaultLoadBalancer”. There is a new StochasticsLoadBalancer also which can be used.

Meta Node Tracker

Watches the zNode called “unassigned” used by the META table. Used by CatalogTracker to track the location of the meta table.

Master Address Tracker

Used by Active Master Manager to manage the current location of the master for the Region Servers.

4 ) File System Interfaces

All the services which interacts with the underlying FileSystem to store or manage data pertaining to the control of a Hmaster is lumped under this section

MasterFileSystem

This class abstracts the file system operation for HBase including identifying base directory, log splitting, Delete Region, Delete Table etc.

Log Cleaner

This is a chore (see next section) which runs at some specified interval and attempt to delete the Hlogs in the oldlogs directory. This is a chain of cleaner delegate which can be used to clean any kind of log files. By default, two cleaners: TimeToLiveLogCleaner and ReplicationLogCleaner are called in order. So if other effects are needed, implement your own LogCleanerDelegate and add it to the configuration “hbase.master.logcleaner.plugins”, which is a comma-separated list of fully qualified class names. LogsCleaner will add it to the chain. HBase ships with LogsCleaner as the default implementation.

HFile Cleaner

This is also a chore (see next section) which runs at some specified intervals. This handles the HFile cleaning functions inside the master. By default, only the TimeToLiveHFileCleaner is called. If other effects are needed, implement your own LogCleanerDelegate and add it to the configuration “hbase.master.hfilecleaner.plugins”, which is a comma-separated list of fully qualified class names. The <code>HFileCleaner<code> will build the cleaner chain in  order the order specified by the configuration.

5 ) Chores

Chore is a task performed on a period in hbase.  The chore is run in its own thread. This base abstract class provides while loop and sleeping facility. If an unhandled exception, the threads exit is logged. Implementers just need to add checking if there is work to be done and if so, do it.  Its the base of most of the chore threads in hbase. Don’t subclass Chore if the task relies on being woken up for something to do, such as an entry being added to a queue, etc.

Balancer Chore

The balancer is a tool that balances disk space usage on an HDFS cluster when some datanodes become full or when new empty nodes join the cluster. The tool is deployed as an application program that can be run by the cluster administrator on a live HDFS cluster while applications adding and deleting files.

The threshold parameter is a fraction in the range of (1%, 100%) with a default value of 10%. The threshold sets a target for whether the cluster is balanced. A cluster is balanced if for each datanode, the utilization of the node (ratio of used space at the node to total capacity of the node) differs from the utilization of the (ratio of used space in the cluster to total capacity of the cluster) by no more than the threshold value. The smaller the threshold, the more balanced a cluster will become. It takes more time to run the balancer for small threshold values. Also for a very small threshold the cluster may not be able to reach the balanced state when applications write and delete files concurrently.

The tool moves blocks from highly utilized datanodes to poorly utilized datanodes iteratively. In each iteration a datanode moves or receives no more than the lesser of 10G bytes or the threshold fraction of its capacity. Each iteration runs no more than 20 minutes. At the end of each iteration, the balancer obtains updated datanodes information from the namenode.

A system property that limits the balancer’s use of bandwidth is defined in the default configuration file:

   dfs.balance.bandwidthPerSec

This property determines the maximum speed at which a block will be moved from one datanode to another. The default value is 1MB/s. The higher the bandwidth, the faster a cluster can reach the balanced state, but with greater competition with application processes. If an administrator changes the value of this property in the configuration file, the change is observed when HDFS is next restarted.

Catalog Janitor Chore

A janitor for catalog tables. It scans the META tables for looking for unused regions to garbage collect.

Log Cleaner Chore

Explained in the previous section

HFile Cleaner Chore

Explained in the previous section

6 ) Others

Server Manager

The ServerManager class manages info about region servers.Maintains lists of online and dead servers. Processes the startups, shutdowns, and deaths of region servers. Servers are distinguished in two different ways. A given server has a location, specified by hostname and port, and of which there can only be one online at any given time. A server instance is specified by the location (hostname and port) as well as the startcode (timestamp from when the server was started). This is used to differentiate a restarted instance of a given server from the original instance.

Co-Processor Host

 Provides the common setup framework and runtime services for coprocessor invocation from HBase services.

Buck电路中自举电容串联小电阻的作用 在Buck电路中,自举电容(Cboot)驱动高边MOSFET时,因寄生电感和电容会形成LC谐振回路,导致SW节点高频振铃,引发EMI问题。串联小电阻(Rboot)可引入阻尼效应,抑制振铃、改善波形和EMI性能,但会略微增加开关损耗。设计时建议预留可调电阻位(2Ω~20Ω),根据实测结果平衡效率与系统稳定性,提升电源可靠性。这一措施是优化开关电源EMC的常见实践。 阅读详情

相关推荐

HBase学习笔记(二)HBase架构

HBase Architectural Components(HBase架构组件) HBase架构也是主从架构,由三部分构成HRegionServer、HBase Master和ZooKeeper。 RegionServer负责数据的读写与客户端交互,对于region的操作则是由HMaster处理,ZooKeeper则是负责维护运行中的节点。 在底层,它将数据存储于HDFS文件中,因而涉及到HD...

微信搜:import_bigdata,大数据领域硬核原创作者 447

HBase Architecture(译):上

转自:http://hi.baidu.com/rebeccacao/blog/item/059aee1ce51b5d014134179e.html HBase Architecture(译):上 2012-01-04 14:01 译者: 2011-10-1 出处:http://duanple.blog.163.com/blog/static/70971767

hua840812的专栏 797

kuka机器人试题.doc

1. 哪个图标代表世界坐标系? 2. 手动移动的速度设置叫什么? 3. 有哪些运行方式? 4. 零点标定目的是什么? 6. 请给出机械零位时的所有 6 根轴的角度。 A1: .............................. A2: .............................. A3: .............................. A4: .............................. A5: .............................. A6: .............................. 7. 删除机器人零点时必须注意些什么?. 8. 哪些零点标定工具应优先使用? 9. 工具测量方法有哪些? 10. 什么可以通过 XYZ 4 点法确定? 11. 哪个图标代表工具坐标系? 12. 控制器最多可管理多少工具? 13. 工具负荷数据中的值 -1 表示什么? ----------------------- kuka机器人试题全文共1页,当前为第1页。

HBase1.2官方文档——Architecture

架构 Architecture 63. 概述 Overview 63.1. NoSQL? HBase是一种 "NoSQL" 数据库。"NoSQL"是一个通用词表示数据库不是RDBMS ,后者支持 SQL 作为主要访问语言。有许多种 NoSQL 数据库: BerkeleyDB 是本地 NoSQL 数据库例子, 而 HBase 是大型分布式数据库。技术上来说, HBase 更像是...

weixin_30782331的博客 691

HMaster是什么?

HMasterHBase 集群中的主服务器,负责监控集群中的所有 RegionServer,并且是所有元数据更改的接口。 在分布式集群中,HMaster 服务器通常运行在 HDFS 的 NameNode上,HMaster 通过 ZooKeeper 来避免单点故障,在集群中可以启动多个 HMaster,但 ZooKeeper 的选举机制能够保证同时只有一个 HMaster 处于 Active 状态,其他的 HMaster 处于热备份状态。 HMaster 主要负责表和 Region 的管理工作。 管理

张俊杰 的博客 6063

Hbase shell的基本操作

HBase Shell一些基本操作命令的说明:base shell命令  描述 alter修改列族(column family)模式count统计表中行的数量create创建表describe显示表相关的详细信息delete删除指定对象的值(可以为表,行,列对应的值,另外也可以指定时间戳的值)deleteall删除指定行的所有元素值disable使表无效drop删除表enable使表有效exist...

IT影风的博客 2773

HBase启动不了的一个原因处理

几天没有启动hbase,今天重新启动,却发现 HRegionServer没有启动,  到 region server 查看 jps,里面只有HQuorumPeer,没有 HRegionServer。  于是就单独启动:  Java代码   hbase-daemon.sh --config /usr/local/hbase/hbase-conf start regions

逸卿的专栏 5967

HBase HMaster Architecture - HBase Master架构

HBase architecture follows the traditional master slave model where you have a master which takes decisions and one or more slaves which does the real task. In HBase, the master is called HMaster  and

技术笔记本 3811

Apache HBase 架构

HBase架构图的理解 Client 包含访问hbase的接口,client维护着一些cache来加快对hbase的访问,比如regione的位置信息。 Zookeeper 保证任何时候,集群中只有一个master 存贮所有Region的寻址入口 实时监控Region Server的状态,将Region server的上线和下线信息实时通知给Master 存储Hbase的schema,包括...

大数据流浪法师的学习笔记与分享 346

An In-Depth Look at the HBase Architecture--转载

原文地址:https://www.mapr.com/blog/in-depth-look-hbase-architecture In this blog post, I’ll give you an in-depth look at the HBase architecture and its main benefits over NoSQL data store solutions....

246

An In-Depth Look at the HBase Architecture

from:https://mapr.com/blog/in-depth-look-hbase-architecture/ In this blog post, I’ll give you an in-depth look at the HBase architecture and its main benefits over NoSQL data store solutions. Be sure...

longxibendi的专栏 835

HBase架构 http://hbase.apache.org/book.html#_architecture

1.Master HMaster是Master Server的实现,HMaster负责监控集群里所有RegionServer,HMaster也是管理所有元数据,一般HMaster和HDFS的NameNode同在一台机器上运行。 一个最普遍的问题就是如果HMaster宕机了怎么办,因为HBase的客户端是直接和RegionServer通信的,所以如果HMaster宕机,整个集群仍会在一个“稳定的状

开卷有益 1067

Hbase的体系架构讲解

Hbase的体系架构 详细架构图 Client HBase Client使用HBase的RPC机制与HMaster和HRegionServer进行通信,对于管理类操作,Client与HMaster进行RPC;对于数据读写类操作,Client与HRegionServer进行RPC。 Zookeeper Zookeeper Quorum中除了存储了ROOT表的地址和HMaster的地址,HRe...

lds_include 534

Hbase三大组件 -- Region Server、HMaster、Zookeeper 介绍

1)实时查询,可以认为是从内存中查询,一般响应时间在1秒内。HBase的机制是数据先写入到内存中,当数据量达到一定的量(如128M),再写入磁盘中, 在内存中,是不进行数据的更新或合并操作的,只增加数据,这使得用户的写操作只要进入内存中就可以立即返回,保证了HBase I/O的高性能。1) 在HBaseHmaster负责监控RegionServer的生命周期,均衡RegionServer的负载,如果Hmaster挂掉了,那么整个HBase集群将陷入不健康的状态,并且此时的工作状态并不会维持太久。

小方的博客 6094

Hbase启动没有HMaster进程问题解决

目录1.问题2.解决2.1 启动的报错2.2 NameNode 状态问题2.3 日志机架感知报错3.问题解决 1.问题 之前已在虚拟机安装好了zookeeper和hdfs2.3.6,并确认这两个东西能正常使用。安装好hbase1.4.1后启动找不到hmaster进程,已确认没有版本冲突。但能启动HRegionServer进程。然后ip:16010/master-status访问根本拒绝访问。 2.解决 2.1 启动的报错 启动报错 OpenJDK 64-Bit Server VM warning: ign

mizuhokaga的博客 2万+

HMasterHBase集群管理器

1.背景介绍 HBase是一个分布式、可扩展、高性能的列式存储系统,基于Google的Bigtable设计。HMasterHBase集群管理器,负责管理HBase集群中的所有RegionServer和Region。在本文中,我们将深入了解HMaster的核心概念、算法原理、最佳实践以及实际应用场景。 1.背景介绍 HBase作为一个分布式数据库,具有高可用性、高性能和高可扩展性。HMast...

AI天才研究院 1531

HBase入门:运行机制

这种方式的缺点:如果一个 Region 服务器发生故障,为恢复其上的Region 对象,需要将 Region 服务器上的 HLog 按照其所属的 Region 对象进行拆分,然后分发到其他 Region 服务器上执行恢复操作。系统根据每条日志记录所属的 Region 对象对 HLog 数据进行拆分,分别放到相应 Region 对象的目录下,然后将失效的 Region 重新分配到可用的 Region 服务器中,并把与该 Region 对象相关的HLog 日志记录也发送给相应的 Region 服务器。

缘友一世的博客 1843

大数据HBase 集群搭建(master、slave1和slave2)

大数据的概念在不断地发酵,进入这个领域的人越来越多。在大数据的领域内,HBase的概念已成为企业和求学者都需要关注的一个重点。HBase是一个分布式的、面向列的开源数据库,该技术来源于 Fay Chang 所撰写的Google论文“Bigtable:一个结构化数据的分布式存储系统”。就像Bigtable利用了Google文件系统(File System)所提供的分布式数据存储一样,HBase在Hadoop之上提供了类似于Bigtable的能力。HBase是Apache的Hadoop项目的子项目。

梁辰兴的博客 3337

java.lang.IllegalArgumentException: no server available 报错: 没有可用的服务器

报错信息: java.lang.IllegalArgumentException: no server available at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:354) ~[nacos-client-1.0.0.jar:na] at com.alibaba....

牧牛人Alec 3088
上一篇: Using the libjars option with Hadoop
下一篇: Setup Multi Hbase master on Hadoop Cluster
llystar
博客等级 码龄23年 0粉丝 56原创
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值