gpt4 book ai didi

linux - 什么时候需要设置 Block replication 为 1

转载 作者:太空宇宙 更新时间:2023-11-04 12:12:12 25 4
gpt4 key购买 nike

我们在 Spark 日志中得到以下内容:

java.io.IOException: Failed to replace a bad datanode on the existing pipeline due to no more good datanodes being available to try. (Nodes: current=[DatanodeInfoWithStorage DatanodeInfoWithStorage\
The current failed datanode replacement policy is DEFAULT, and a client may configure this via 'dfs.client.block.write.replace-datanode-on-failure.policy' in its configuration.
at org.apache.hadoop.hdfs

.DFSOutputStream$DataStreamer.findNewDatanode(DFSOutputStream.java:1036)

我的 Ambari 集群只有 3 台 worker 机器,每个 worker 只有一个数据盘。

我在 Google 上搜索,发现解决方案可能与 block 复制有关。 HDFS 中的 block 复制默认配置为 3,我发现将“ block 复制”设置为 1 而不是 3 的建议。

问题:有道理吗?

另外,我的工作机器只有一个数据磁盘这一事实是否也是问题的一部分?

Block replication = The total number of files in the file system will be what's specified in the dfs.replication factor setting dfs.replication=1, means will be only one copy of the file in the file system.

完整日志:

java.io.IOException: Failed to replace a bad datanode on the existing pipeline due to no more good datanodes being available to try. (Nodes: current=[DatanodeInfoWithStorage[34.2.31.31:50010,DS-8234bb39-0fd4-49be-98ba-32080bc24fa9,DISK], DatanodeInfoWithStorage[34.2.31.33:50010,DS-b4758979-52a2-4238-99f0-1b5ec45a7e25,DISK]], original=[DatanodeInfoWithStorage[34.2.31.31:50010,DS-8234bb39-0fd4-49be-98ba-32080bc24fa9,DISK], DatanodeInfoWithStorage[34.2.31.33:50010,DS-b4758979-52a2-4238-99f0-1b5ec45a7e25,DISK]]). The current failed datanode replacement policy is DEFAULT, and a client may configure this via 'dfs.client.block.write.replace-datanode-on-failure.policy' in its configuration.
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.findNewDatanode(DFSOutputStream.java:1036)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.addDatanode2ExistingPipeline(DFSOutputStream.java:1110)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.setupPipelineForAppendOrRecovery(DFSOutputStream.java:1268)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.processDatanodeError(DFSOutputStream.java:993)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:500)
---2018-01-30T15:15:15.015 INFO [][][] [dal.locations.LocationsDataFramesHandler]

最佳答案

我遇到了同样的问题。默认的 block 复制是 3。因此,除非您另有指定,否则所有文件都以复制因子 3 创建。

如果无法访问任何数据节点(网络问题或磁盘空间不足),则复制将失败。

检查数据节点状态使用:

hdfs dfsadmin -report

在我的例子中,我有 2 个开发节点,1 个是主节点,1 个是数据节点。因此,我将复制因子更改为 1。

您可以先从 hdfs cli 进行测试,如下所示:

    echo "test file line1" > copy1
echo "test file line2" > copy2
hdfs dfs -Ddfs.replication=1 -touchz /tmp/appendtest.txt
hdfs dfs -appendToFile copy1 /tmp/appendtest.txt
hdfs dfs -appendToFile copy2 /tmp/appendtest.txt

如果在 touchz 命令中,你没有指定复制因子,当你尝试追加本地文件 copy2 时,你会得到同样的错误

hdfsConfig 对象的以下配置为我解决了这个问题:

  hdfsConfiguration.set("fs.defaultFS", configuration.getString("hdfs.uri"))
hdfsConfiguration.set("fs.hdfs.impl", classOf[org.apache.hadoop.hdfs.DistributedFileSystem].getName)
hdfsConfiguration.set("fs.file.impl", classOf[org.apache.hadoop.fs.LocalFileSystem].getName)
hdfsConfiguration.set("dfs.support.append", "true")
hdfsConfiguration.set("dfs.replication", "1")

关于linux - 什么时候需要设置 Block replication 为 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48535714/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com