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 ...
最新文章
- 2022-2028年中国喷涂速凝橡胶行业市场调研分析及未来前景分析报告
- 元宇宙中可跨语种交流!Meta 发布新语音模型,支持128种语言无障碍对话
- Windows7瘦身和备份
- UVA10382喷水装置
- Linux系统IO分析工具之iotop常用参数介绍
- 充分利用Microsoft Planner的6种方法
- php循环checkbox,php循环删除checkbox | 学步园
- Jenkins打卡Day19-Jenkins重启关闭服务
- 字符集在本地化过程中的影响
- 精选32个最新Python实战项目(附源码),拿走就用
- 蓝桥杯C++AB算法辅导
- 阿里云服务器搭建Ghost博客教程
- JimuReport积木报表 — SQL数据源报表制作
- Qt添加工具栏按钮————附详细步骤
- python 学生成绩统计
- 面向对象文字游戏,蜈蚣怪和蛇怪
- uni-app 报错getUserProfile:fail can only be invoked by user TAP gesture.
- 在家怎么做炸酱面 炸酱面做法
- 一位网友的网络求职经历
- 爬虫系列 | 4、详解Requests的用法
热门文章
- 【NOIP2017模拟6.25】小W的动漫
- c# linq的差集,并集,交集,去重【转】
- select * 和select 所有字段的区别
- Struts2学习总结(完整版)
- PHP的time函数返回时间不正确
- 求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加...
- hasLayout和filter滤镜的细节
- IIS 崩溃的后的感受
- myabtis 数字+逗号 传参问题 $和#
- niceyoo的2020年终总结-2021年Flag