HDFS中副本存储节点选择——机架感知

HDFS中副本存储节点选择——机架感知,第1张

HDFS中副本存储节点选择——机架感知

HDFS中副本存储节点的选择是根据机架感知来选择的。

副本数量默认为3。可以通过配置进行修改,但设置副本数应满足不大于DataNode的数量。比如目前只有3台设备,最多也就3个副本,只有节点数的增加到10台时,副本数最多才能达到10。

副本节点选择的原则(以副本数为3举例):

第一个副本:在Client所在的节点上,如果客户端在集群外,则随机挑选一个节点。

第二个副本:在另一个机架上随机挑选一个节点。

第三个副本:在第二个副本所在的机架内再随机挑选一个节点。

机架感知官方说明(附中文翻译):

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.
对于常见情况,当复制系数为3时,HDFS的放置策略是,如果写入程序位于datanode上,则将一个副本放置在本地计算机上,否则放置在随机datanode上,另一个副本放置在不同(远程)机架中的节点上,最后一个副本放置在同一远程机架中的不同节点上。此策略减少机架间写入通信量,这通常会提高写入性能。机架故障的概率远小于节点故障的概率;此策略不会影响数据可靠性和可用性保证。但是,它确实减少了读取数据时使用的总网络带宽,因为一个块只放在两个而不是三个唯一的机架中。使用此策略,文件的副本不会均匀分布在机架上。三分之一的副本位于一个节点上,三分之二的副本位于一个机架上,另三分之一均匀分布在其余机架上。此策略在不影响数据可靠性或读取性能的情况下提高了写入性能。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5652480.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存