• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
导航菜单
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • windows
  • 服务器硬件
  • 服务器运维
  • 云计算
  • 虚拟化
  • IIS教程
  • Linux
  • Apache
  • Ftp
  • DNS
  • Nginx
您的位置:首页 > 服务器 >IIS教程 > 强制DataNode向NameNode上报blocks

强制DataNode向NameNode上报blocks

作者:网友 字体:[增加 减小] 来源:互联网

本文主要包含namenode datanode,datanode无法启动,datanode,datanode是什么,hadoop datanode等服务器相关知识,网友希望可以进行参考

强制DataNode向NameNode上报blocks


正常情况下,什么时候上报blocks,是由NameNode通过回复心跳响应的方式触发的。
一次机房搬迁中,原机房hadoop版本为2.7.2,新机房版本为2.8.0,采用先扩容再缩容的方式搬迁。由于新旧机房机型不同和磁盘数不同,操作过程搞混过hdfs-site.xml,因为两种不同的机型,hdfs-site.xml不便做到相同,导致了NameNode报大量“missing block”。

然而依据NameNode所报信息,在DataNode能找到那些被标记为“missing”的blocks。修复配置问题后,“missing block”并没有消失。结合DataNode源代码,估计是因为DataNode没有向NameNode上报blocks。

结合DataNode的源代码,发现了HDFS自带的工具triggerBlockReport,它可以强制指定的DataNode向NameNode上报块,使用方法为:
hdfs dfsadmin -triggerBlockReport datanode_host:ipc_port
如:hdfs dfsadmin -triggerBlockReport 192.168.31.35:50020

正常情况下NameNode启动时,会要求DataNode上报一次blocks(通过fullBlockReportLeaseId值来控制),相关源代码如下:

DataNode相关代码(BPServiceActor.java):
private void offerService() throws Exception {
HeartbeatResponse resp = sendHeartBeat(requestBlockReportLease); // 向NameNode发向心跳
long fullBlockReportLeaseId = resp.getFullBlockReportLeaseId(); // 心跳响应
boolean forceFullBr = scheduler.forceFullBlockReport.getAndSet(false); // triggerBlockReport强制上报仅一次有效
if (forceFullBr) {
LOG.info("Forcing a full block report to " + nnAddr);
}
if ((fullBlockReportLeaseId != 0) || forceFullBr) {
cmds = blockReport(fullBlockReportLeaseId);
fullBlockReportLeaseId = 0;
}
}

// NameNode相关代码(FSNamesystem.java):
/**
* The given node has reported in. This method should:
* 1) Record the heartbeat, so the datanode isn't timed out
* 2) Adjust usage stats for future block allocation
*
* If a substantial amount of time passed since the last datanode
* heartbeat then request an immediate block report.
*
* @return an array of datanode commands
* @throws IOException
*/
HeartbeatResponse handleHeartbeat(DatanodeRegistration nodeReg,
StorageReport[] reports, long cacheCapacity, long cacheUsed,
int xceiverCount, int xmitsInProgress, int failedVolumes,
VolumeFailureSummary volumeFailureSummary,
boolean requestFullBlockReportLease) throws IOException {
readLock();
try {
//get datanode commands
final int maxTransfer = blockManager.getMaxReplicationStreams() - xmitsInProgress;
DatanodeCommand[] cmds = blockManager.getDatanodeManager().handleHeartbeat(
nodeReg, reports, blockPoolId, cacheCapacity, cacheUsed,
xceiverCount, maxTransfer, failedVolumes, volumeFailureSummary);

long fullBlockReportLeaseId = 0;
if (requestFullBlockReportLease) {
fullBlockReportLeaseId = blockManager.requestBlockReportLeaseId(nodeReg);
}
//create ha status
final NNHAStatusHeartbeat haState = new NNHAStatusHeartbeat(
haContext.getState().getServiceState(),
getFSImage().getCorrectLastAppliedOrWrittenTxId());

return new HeartbeatResponse(cmds, haState, rollingUpgradeInfo, fullBlockReportLeaseId);
} finally {
readUnlock("handleHeartbeat");
}
}


分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • 强制DataNode向NameNode上报blocks
  • 强制DataNode向NameNode上报blocks

相关文章

  • nginx 配置禁止访问目录或文件
  • 聚焦云数据中心安全 浪潮将推云主机安全产品解决方案
  • 应用:在Linux系统下配置WU-FTP服务器
  • iis返回状态200、301、404等的含义
  • nginx location 指令匹配顺序
  • 从DNS服务器的含义 浅淡如何进行管理
  • U-Mail for CentOS(6.X) 安装教程(一体盘)
  • Discuz!升级到新安装X出现ucenter中用户为1的问题
  • 走进青岛中集 看IT轻盈之道
  • 网络基础知识:域名、IP地址及DNS域名解析

文章分类

  • windows
  • 服务器硬件
  • 服务器运维
  • 云计算
  • 虚拟化
  • IIS教程
  • Linux
  • Apache
  • Ftp
  • DNS
  • Nginx

最近更新的内容

    • 致DBA:为什么你经常犯错,是因为你做的功课不够
    • 为jenkins的每个build设置description(转自hp_truth的文章)
    • 应用:在Linux系统下配置WU-FTP服务器
    • Linux下vsftp的安装和配置方法
    • php中利用PHPMailer插件实现gmail发送邮件
    • Service Unavailable关于IIS连接数的几种解释
    • Discuz!转换到X以后用户组为空的解决方法
    • 云智慧透视宝Java代码性能监控实现原理
    • Apache Commons Lang 3.3.2 发布
    • FTP服务器架设考虑三方面的安全因素

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有