hadoop loadBalance源码分析
项目hbase数据库出现很诡异的assignment ,region移动的src和dest都是同一台regionserver,不过时间戳不同,启动的只有一个regionserver, 不知道怎么出现了两个时间戳
分析下源码解决一下
// Wait for region servers to report in. this.serverManager.waitForRegionServers(status); // Check zk for regionservers that are up but didn't register for (ServerName sn: this.regionServerTracker.getOnlineServers()) { if (!this.serverManager.isServerOnline(sn)) { // Not registered; add it.LOG.info("Registering server found up in zk but who has not yet " +"reported in: " + sn);this.serverManager.recordNewServer(sn, HServerLoad.EMPTY_HSERVERLOAD);} }
serverManager线程sleep一定时间,等待HRegionServer注册
HRegionServer.java:
// Try and register with the Master; tell it we are here. Break if// server is stopped or the clusterup flag is down or hdfs went wacky.while (keepLooping()) {MapWritable w = reportForDuty();if (w == null) {LOG.warn("reportForDuty failed; sleeping and then retrying.");this.sleeper.sleep();} else {handleReportForDutyResponse(w);break;}}
HRegionServer 注册之后进入mainloop
// The main run loop.while (!this.stopped && isHealthy()) { long now = System.currentTimeMillis();
if ((now - lastMsg) >= msgInterval) {
doMetrics();
tryRegionServerReport();
lastMsg = System.currentTimeMillis();
}
}
每隔hbase.regionserver.msginterval时间(默认3秒),进行一次注册尝试,如果服务器ip和端口不在已注册列表中,则添加ServerName进map
ServerManager.java
void regionServerReport(ServerName sn, HServerLoad hsl)throws YouAreDeadException, PleaseHoldException {checkIsDead(sn, "REPORT");if (!this.onlineServers.containsKey(sn)) {// Already have this host+port combo and its just different start code? checkAlreadySameHostPort(sn);// Just let the server in. Presume master joining a running cluster.// recordNewServer is what happens at the end of reportServerStartup.// The only thing we are skipping is passing back to the regionserver// the ServerName to use. Here we presume a master has already done// that so we'll press on with whatever it gave us for ServerName. recordNewServer(sn, hsl);} else {this.onlineServers.put(sn, hsl);}}
recordNewServer 会打印 ServerName对象的ip 端口和时间戳信息
同一个region server注册的ServerName对象 会拥有同样的时间戳
this.startcode = System.currentTimeMillis();...result = this.hbaseMaster.regionServerStartup(port, this.startcode, now);...this.serverNameFromMasterPOV = new ServerName(hostnameFromMasterPOV, this.isa.getPort(), this.startcode);...this.hbaseMaster.regionServerReport(this.serverNameFromMasterPOV.getVersionedBytes(), hsl);
region server启动时startCode是固定死的,按照这个流程是不会出现相同IP和端口,但时间戳不同的region server跑在线上的
如果一台机器上启动了两个region server 会把时间戳小的移出,下次添加进时间戳大的进去
我们遇到的问题是时间戳不同的regionserver被注册在了master上,并且相互之间做region move
转载于:https://www.cnblogs.com/shenguanpu/archive/2012/07/30/2615214.html
hadoop loadBalance源码分析相关推荐
- 第二章:小朱笔记hadoop之源码分析-脚本分析
第二章:小朱笔记hadoop之源码分析-脚本分析 第一节:start-all.sh 第二节:hadoop-config.sh 第三节:hadoop-env.sh 第四节:start-dfs.sh 第五 ...
- 第七章:小朱笔记hadoop之源码分析-hdfs分析 第四节:namenode-LeaseManagerMonitor
第七章:小朱笔记hadoop之源码分析-hdfs分析 第四节:namenode分析 4.4 namenode文件租约分析LeaseManagerMonitor 文件租约就是将操作的文件和操作它的客户端 ...
- 第七章:小朱笔记hadoop之源码分析-hdfs分析 第三节:hdfs实现分析
第七章:小朱笔记hadoop之源码分析-hdfs分析 第三节:hdfs实现分析 3.3 namenode (1)FSDirectory FSDirectory用来管理HDFS整个文件系统的namesp ...
- 第七章:小朱笔记hadoop之源码分析-hdfs分析 第四节:namenode分析-namenode启动过程分析...
第七章:小朱笔记hadoop之源码分析-hdfs分析 第四节:namenode分析 4.1 namenode启动过程分析 org.apache.hadoop.hdfs.server.namenode. ...
- 第七章:小朱笔记hadoop之源码分析-hdfs分析 Datanode 心跳分析
第七章:小朱笔记hadoop之源码分析-hdfs分析 第五节:Datanode 分析 5.2 Datanode 心跳分析 (1)offerService分析 写道 (a)检查心跳间隔是否超时,如是向n ...
- 第七章:小朱笔记hadoop之源码分析-hdfs分析 第五节:Datanode 分析
第七章:小朱笔记hadoop之源码分析-hdfs分析 第五节:Datanode 分析 5.1 Datanode 启动过程分析 5.2 Datanode 心跳分析 5.3 Datanode 注册分析 5 ...
- 第七章:小朱笔记hadoop之源码分析-hdfs分析 第四节:namenode-ReplicationMonitor
第四节:namenode分析 4.3 namenode 副本监控分析ReplicationMonitor ReplicationMonitor主要有两个作用: (1)负责为副本不足的数据块选择sour ...
- 第四章:小朱笔记hadoop之源码分析-conf分析
第三章:小朱笔记hadoop之conf分析 一.Configurable void setConf(Configuration conf); //获取配置信息的方法: Configur ...
- hadoop作业初始化过程详解(源码分析第三篇)
(一)概述 我们在上一篇blog已经详细的分析了一个作业从用户输入提交命令到到达JobTracker之前的各个过程.在作业到达JobTracker之后初始化之前,JobTracker会通过submit ...
最新文章
- 【统计学习方法】感知机对鸢尾花(iris)数据集进行二分类
- matlab读取格式重复,matlab - 为什么Xlsread以字符串形式读取(日期时间) - 堆栈内存溢出...
- 串口IDLE空闲中断+DMA实现接收不定长数据基于stm32cubemx
- 不要再次进行阅读的计算机论文与理由(持续更新中)
- [转]Nant daily build实践
- Snabbdom(虚拟dom-4-init函数)
- 服务器 重启windows_安装Windows 计算机意外
- 7.2 高速缓冲存储器-Cache
- 设某一机器由n个部件组成_组成原理
- 去掉 Warning:$HADOOP_HOME is deprecated
- SQlite数据库的C编程接口(七) 数据库锁定(Database Locking) ——《Using SQlite》读书笔记
- 19款国产手机无一幸免:15分钟破解人脸识别,打印眼镜让刷脸形同虚设
- cass连接复合线命令 lisp_南方CASS和AutoCAD快捷命令大全
- 忠告:使用TNT版本PD的不要升级新版本Mac系统
- 桌面整理助手 - DesktopAssistant 1.2.1.9
- 如何管理比自己强的下属?
- go libp2p kad dht
- 商机管理细化直击销售进展难点,激发销售业绩驱动企业规模化增长!
- python中的一些快捷键
- 谁是未来企业安全的最大“绊脚石”?
热门文章
- [Leetcode 376]摇摆序列 Wiggle Subsequence
- shell语法 06-Linux文本处理-grep
- CAS Client 3.2.1 配置详解
- java中注解的使用与实例(一)
- css定位:相对定位
- hasLayout和filter滤镜的细节
- can't load apple.laf.AquaLookAndFeel (Ant in Eclipse can't find it
- 在VB应用程序中调用Excel2000
- Proxy server 緩存 jsp html
- 网页中的按钮无法显示问题解决