例如,如果复制因子为 3,并且集群中有 2 个节点。那么将创建多少个副本?它们将如何放置?
最佳答案
复制因子大于可用数据节点会破坏复制的目的。副本应该明确且唯一地放置在数据节点上。如果一个数据节点包含同一个 block 的多个副本(理论上),它不会提供额外的容错能力,因为如果该节点出现故障,两个副本都会丢失。因此每个节点只有一个副本就足够了。
并回答您的问题:
What is the relationship between replication factor and number of datanodes in cluster? Ans. Maximum replication factor should be less than or equal to #datanodes
If the replication factor is 3 and there are 2 nodes in cluster. Then how many replicas will be created?
Ans. As far as I tried, only 2 replicas are created. (Try usinghdfs dfs -setrep
option)How will they be placed? Ans. They will be placed one per datanode.
因此,当您提供的复制因子多于 #datanodes 时,您尝试创建的额外副本将在 hdfs fsck
输出中作为 Missing replicas 提及。此外,相应的 block 将被视为复制不足的 block
关于hadoop - 在Hadoop中,复制因子和集群中的节点数之间有什么关系?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45730508/