HDFS 上的文件对应的 Block 保存多个副本,且提供容错机制,副本丢失或者宕机自动恢复,默认是存 3 个副本。

2.8.x之前的副本策略

官方文档说明:

https://hadoop.apache.org/docs/r2.8.0/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html#Data_Replication

For the common case, when the replication factor is three, HDFS’s placement policy is to put one replica on one node in the local rack, another on a different node in the local rack, and the last on a different node in a different rack. This policy cuts the inter-rack write traffic which generally improves write performance. The chance of rack failure is far less than that of node failure; this policy does not impact data reliability and availability guarantees. However, it does reduce the aggregate network bandwidth used when reading data since a block is placed in only two unique racks rather than three. With this policy, the replicas of a file do not evenly distribute across the racks. One third of replicas are on one node, two thirds of replicas are on one rack, and the other third are evenly distributed across the remaining racks. This policy improves write performance without compromising data reliability or read performance.

第一副本:放置在上传文件的 DataNode 上;如果是集群外提交,则随机挑选一个磁盘不太慢、CPU 不太忙的节点。

第二副本:放置在与第一个副本相同的机架的节点上

第三副本:与第二个副本相同机架的不同节点上

如果还有更多的副本:随机放在节点上,同时需要保持每个机架的副本数低于上限,基本上是((replicas - 1) / racks + 2)。

因为 NameNode 不允许 DataNodes 拥有同一个 block 的多个副本,所以能创建的最大副本数就是当时 DataNodes 的总数。

2.9.x之后及3.x的副本策略

官方文档说明:

https://hadoop.apache.org/docs/r2.9.0/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html#Data_Replication

For the common case, when the replication factor is three, HDFS’s placement policy is to put one replica on the local machine if the writer is on a datanode, otherwise on a random datanode, another replica on a node in a different (remote) rack, and the last on a different node in the same remote rack. This policy cuts the inter-rack write traffic which generally improves write performance. The chance of rack failure is far less than that of node failure; this policy does not impact data reliability and availability guarantees. However, it does reduce the aggregate network bandwidth used when reading data since a block is placed in only two unique racks rather than three. With this policy, the replicas of a file do not evenly distribute across the racks. One third of replicas are on one node, two thirds of replicas are on one rack, and the other third are evenly distributed across the remaining racks. This policy improves write performance without compromising data reliability or read performance.

第一副本:放置在上传文件的 DataNode 上;如果是集群外提交,则随机挑选一个磁盘不太慢、CPU 不太忙的节点。

第二副本:放置在与第一个副本不同的机架的节点上

第三副本:与第二个副本相同机架的不同节点上

如果还有更多的副本:随机放在节点上,同时需要保持每个机架的副本数低于上限,基本上是((replicas - 1) / racks + 2)。

因为 NameNode 不允许 DataNodes 拥有同一个 block 的多个副本,所以能创建的最大副本数就是当时 DataNodes 的总数。

Hadoop2.x与Hadoop3.x副本选择机制的更多相关文章

  1. 图文了解 Kafka 的副本复制机制

    让分布式系统的操作变得简单,在某种程度上是一种艺术,通常这种实现都是从大量的实践中总结得到的.Apache Kafka 的受欢迎程度在很大程度上归功于其设计和操作简单性.随着社区添加更多功能,开发者们 ...

  2. Go版本依赖--版本选择机制

    目录 1. 版本选择机制 2.依赖包版本约定 2.1 Go module 之前版本兼容性 2.2 Go module 之后版本兼容性 3. 版本选择机制 3.1 最新版本选择 3.2 最小版本选择 1 ...

  3. Hadoop_HDFS文件读写代码流程解析和副本存放机制

    Hadoop学习笔记总结 01.RPC(远程过程调用) 1. RPC概念 远程过程指的不是同一个进程的调用.它是一种通过网络从远程计算机程序上请求服务,而不需要了解底层网络技术的协议. 不能直接拿到远 ...

  4. Kafka 0.8 副本同步机制理解

    Kafka的普及在很大程度上归功于它的设计和操作简单,如何自动调优Kafka副本的工作,挑战之一:如何避免follower进入和退出同步副本列表(即ISR).如果某些topic的部分partition ...

  5. Kafka副本同步机制

    引用自:http://blog.csdn.net/lizhitao/article/details/51718185 Kafka副本 Kafka中主题的每个Partition有一个预写式日志文件,每个 ...

  6. 大数据入门基础系列之Hadoop1.X、Hadoop2.X和Hadoop3.X的多维度区别详解(博主推荐)

    不多说,直接上干货! 在前面的博文里,我已经介绍了 大数据入门基础系列之Linux操作系统简介与选择 大数据入门基础系列之虚拟机的下载.安装详解 大数据入门基础系列之Linux的安装详解 大数据入门基 ...

  7. font and face, 浅探Emacs字体选择机制及部分记录

    缘起 最近因为仰慕org-mode,从vim迁移到了Emacs.偶然发现org-mode中调出的calendar第一行居然没有对齐,排查一下发现是字体的问题.刚好也想改改Emacs的字体,于是我就开始 ...

  8. 大数据篇:HDFS

    HDFS HDFS是什么? Hadoop分布式文件系统(HDFS)是指被设计成适合运行在通用硬件(commodity hardware)上的分布式文件系统(Distributed File Syste ...

  9. 深入理解 Kafka 副本机制

    一.Kafka集群 二.副本机制         2.1 分区和副本         2.2 ISR机制         2.3 不完全的首领选举         2.4 最少同步副本         ...

随机推荐

  1. CentOS7下修改默认网卡名为eth0的方法

    1.修改网卡配置文件中的 DEVICE=参数的,关于eth0 [root@ansheng ~ ]# cd /etc/sysconfig/network-scripts/ [root@ansheng n ...

  2. C++奇异递归模板模式

    虚函数的问题 虚函数的主要问题是性能开销比较大,一个虚函数调用可能需要花费数倍于非虚函数调用的时间,尤其是当非虚函数被声明为inline时(注意,虚函数不能被内联). CRTP介绍 CRTP的全称是C ...

  3. Hbuilderx换行问题(属性合并一行展示)

    1. 标签折行,非吾所愿(格式化代码快捷键:Ctrl + K)  2. 打开工具-设置 3. 点击左侧插件配置,点击右边下侧jsbeautify 4. 将原本的折行长度由120改为1200(长度可根据 ...

  4. C#异步编程由浅入深(三)细说Awaiter

      上一篇末尾提到了Awaiter这个类型,上一篇说了,能await的对象,必须包含GetAwaiter()方法,不清楚的朋友可以看上篇文章.那么,Awaiter到底有什么特别之处呢?   首先,从上 ...

  5. Tableau“出走中国”,“卖”给阿里,中国BI用户该何去何从?

    11月,Tableau在发给客户的邮件中透露将停止中国的直销业务,加入阿里的合作体系.消息来的如此突然,Tableau的同仁.合作伙伴.客户.用户.爱好者,甚至友商,无一不感到震惊和担忧. 在我们数据 ...

  6. 打破刻板印象,了解真正的商业智能BI

    ​在技术飞速发展的过程中,人们越来越怀疑传统的数据分析方法.可以通过对商业智能的各种误解来解释这一点,如今,这种误解正在作为有效的真理传播.例如,数据仓库已达到其目标.而数据质量似乎也正在失去其相关性 ...

  7. 解构函数(Deconstruct)

    元组的解构是C#内置支持的. var countrInfo = ("Malawi", "Lilongwe", io); (string name, string ...

  8. WPF中RichTextBox中添加文字的两种方法

    RichTextBox控件不同于TextBox控件,后者可以直接通过其Text属性绑定或者在后台动态添加文字. (一)使用数据绑定 <RichTextBox FontSize="12& ...

  9. Winform实现客户端的自动更新

              话不多说,直接上干货.当然也希望各位前辈多多指导. 自动更新客户端的设计原理图 请花两分钟时间,仔细阅读下面这张图,明白客户端自动升级的原理.        自动更新的效果图 1. ...

  10. updatexml , extractvalue 报错注入

    过滤了union, < ,> = 空格过滤,()没有被过滤 updatexml没有被过滤 那么就不能用布尔类型注入 数据库名 username=admin'or(updatexml(1,c ...