文章来源:HDFS DataNode Scanners and Disk Checker Explained

以下只简单翻译部分文字,详情看英文原文。

简单的概念

一个文件包含多个block,一个block有一个或多个副本。

block存储在每台机器的磁盘上,并且包含个blk_xxx.meta信息,meta中包含crc校验信息等。

这篇文章为了解答以下问题

datanode什么时候检查blocks,如何做的检查?

datanode怎么保证内存(in-memory)中的metadata和本地磁盘保持一致?

如果发生block读失败,是因为磁盘错误吗?还是因为其他间歇性的错误(例如网络中断)?

Block Scanner & Volume Scanner

每个datanode有一个block scanner,一个block scanner包含有多个volume scanner,每个volume scanner扫描一个磁盘。这里是多线程的。volume scanner需要读取全部磁盘的数据,验证每一个block,我们称这个为常规扫描(regular scans)。因为要真实读取数据,这是一个重IO的操作,这里会有个限速器。

除了常规扫描外,volume scanner还维护了一份suspicious blocks(怀疑有问题的blocks列表),它是在出现读写错误的时候(不管是来自于client或者datanode),并且不是网络错误,加进这个列表里面。volume scanner会优先检查这些文件。

每个volume有一个block cursor来保存扫描进度,重启datanode也可以接着上次干活。

hdfs-site.xml中有两个参数

dfs.block.scanner.volume.bytes.per.second  每秒最多扫描的字节数,Default value is 1M. Setting this to 0 will disable the block scanner.

dfs.datanode.scan.period.hours 每次扫描间隔多长时间,如果扫描提前完成了,就等。如果超过时间都没完成,就一直做完。Default value is 3 weeks (504 hours). Setting this to 0 will use the default value. Setting this to a negative value will disable the block scanner.

Directory Scanners

用来检查datanode内存的元数据和磁盘实际存储的是不是一致,主要检查文件在不在,meta信息在不在,文件大小和内存中的是不是一样。

如果一个block被标记为corrupted,会通过block report汇报给namenode,namenode安排从其他完好的replicas复制过来。

参数配置:

dfs.datanode.directoryscan.throttle.limit.ms.per.sec controls how many milliseconds per second a thread should run. Note that this limit is taken per thread, not an aggregated value for all threads. Default value is 1000, meaning the throttling is disabled. Only values between 1 and 1000 are valid.

dfs.datanode.directoryscan.threads controls the maximum number of threads a directory scanner can have in parallel. Default value is 1.

dfs.datanode.directoryscan.interval controls the interval, in seconds, that the directory scanner thread runs. Setting this to a negative value disables the directory scanner. Default value is 6 hours (21600 seconds).

Disk Checker

主要检查目录在不在,能不能建子目录,location路径是不是目录,目录有没有read、write、execute权限。

检查时机:

While block scanners and directory scanners are activated on DataNode startup and scans periodically, the disk checker only runs on-demand, with the disk checker thread lazily created. Specifically, the disk checker only runs if an IOException is caught on the DataNode during regular I/O operations (e.g. closing a block or metadata file, directory scanners reporting an error, etc.).

发现坏的volume如何处理:

The reason to have the disk checker is that, if something goes wrong at the volume level, HDFS should detect it and stop trying to write to that volume. On the other hand, removing a volume is non-trivial and has wide impacts, because it will make all the blocks on that volume inaccessible, and HDFS has to handle all the under-replicated blocks due to the removal. Therefore, disk checker performs the most basic checks, with a very conservative logic to consider a failure.

小结:

Volume Scanner是做磁盘数据的检查,一个DataNode由多块磁盘组成。

Directory Scanners 负责内存和硬盘数据保持一致。

Disk Checker 负责磁盘健康性的偏硬件方面的检查。

参考 <http://fatkun.com/2017/07/hdfs-health-check.html>

HDFS文件的健康检查相关推荐

  1. 小麦苗健康检查脚本说明

    小麦苗健康检查脚本说明 小麦苗健康检查脚本说明 第一章 小麦苗健康检查脚本特点 小麦苗健康检查脚本有如下的特点: 1. 绿色版.免安装.纯SQL文本 2. 跨平台,只要有SQL*Plus环境即可运行 ...

  2. 小麦苗健康检查脚本说明(Oracle巡检脚本)

    小麦苗健康检查脚本说明 第一章 小麦苗健康检查脚本特点 小麦苗健康检查脚本有如下的特点: 1. 绿色版.免安装.纯SQL文本 2. 跨平台,只要有SQL*Plus环境即可运行 3. 兼容Oracle ...

  3. HDFS健康检查 hdfs fsck

    检查hdfs 文件系统的健康状况 hdfs fsck / :从根目录检查每个文件的数据块是否损坏.丢失 [hadoop@ruozedata001 sbin]$ hdfs fsck /Connectin ...

  4. 体检系统前端源码_给您的前端进行健康检查

    体检系统前端源码 by Ewa Mitulska-Wójcik 伊娃·米图尔斯卡(EwaMitulska-Wójcik) 给您的前端进行健康检查 (Give your Front End a Heal ...

  5. 负载均衡中的服务器健康检查

    为了确保应用的高可用性,在做服务器负载均衡时,负载均衡器对服务器做健康检查是必须的.健康检查可以应用到服务器.服务器端口.服务组(Service-group)3个层面,之间是否有关联?应当如何应用?下 ...

  6. 聊聊Spring Boot服务监控,健康检查,线程信息,JVM堆信息,指标收集,运行情况监控等!...

    来自:https://juejin.im/post/5e2179def265da3e152d2561 前言 去年我们项目做了微服务1.0的架构转型,但是服务监控这块却没有跟上.这不,最近我就被分配了要 ...

  7. Spring Boot 服务监控,健康检查,线程信息,JVM堆信息,指标收集,运行情况监控...

    作者:Richard_Yi 来源:http://39sd.cn/B2A0B 去年我们项目做了微服务1.0的架构转型,但是服务监控这块却没有跟上.这不,最近我就被分配了要将我们核心的微服务应用全部监控起 ...

  8. 运维企业专题(8)LVS高可用与负载均衡后篇——LVS健康检查与高可用详解

    实验准备 1.下面的实验使用的是rhel6系列(rhel6.5)的虚拟机,因此你需要有对应的镜像和yum源 2.准备三台虚拟机,为了区分主机名与IP分别为 server1 172.25.6.1 ser ...

  9. linux网络健康度检测,linux运维、架构之路-K8s健康检查Health Check

    一.Health Check介绍 强大的自愈能力是k8s容器编排引擎一个重要特性,自愈能力的默认实现方式为自动重启发生故障的容器,另外还可以利用Liveness和Readiness探测机制设置更精细的 ...

最新文章

  1. 微信小程序获取多选框选中值和选中值对应的id
  2. indexedDB数据库的使用
  3. 面向对象---类与对象
  4. 关键字提取_Excel根据2个关键字,批量提取字符
  5. 网管型光纤收发器产品功能特性详解
  6. “约见”面试官系列之常见面试题之第一百零三篇之vue-router实现路由懒加载(建议收藏)
  7. php _trait,php Trait的使用
  8. java基础Runtime类的使用
  9. 宕机日志怎么看 thread detail_如何快速过滤出一次请求的所有日志?
  10. 拖动布局之保存布局页面
  11. ASP.NET中常用的优化性能的方法(转贴,Icyer收集整理)
  12. 怎样搬运视频不侵权,王者剪辑的指纹检测如何检测原创度
  13. Robo3T操作MongoDB数据库常用命令
  14. python最优投资组合_CVXOPT投资组合优化
  15. notablilty笔记本模板_notability实测,让你上天的笔记软件
  16. IT是什么行业?就业前景怎么样
  17. Java中线程同步锁和互斥锁有啥区别?看完你还是一脸懵逼?
  18. flex实现自定义鼠标
  19. yarn 修改国内镜像
  20. Office - PPT 02

热门文章

  1. Atlas血缘分析在数据仓库中的实战案例
  2. 用word2016/2019写论文或修改论文时出现文件发生错误解决办法
  3. linux 命令设置ip,linux下配置ip地址四种方法(图文方法)
  4. 模拟地和数字地之间的连接方法
  5. Python基础操作真题(三)
  6. 新概念英语第三册41-50课(转)
  7. 2.学习Vue入门知识点
  8. 拼多多“务农”,为何“真香”?
  9. 51单片机(4)-------单片机开发板
  10. Java编程-计算矩形的周长和面积