atsky123 发表于 2013-10-25 10:44:58

Could not obtain block错误

错误信息:
root@Test:/usr/local/hadoop/bin# ./hadoop fs -cat /hello.txt
10/01/11 10:54:59 INFO hdfs.DFSClient: No node available for block: blk_4128181309487486357_1274 file=/hello.txt
10/01/11 10:54:59 INFO hdfs.DFSClient: Could not obtain block blk_4128181309487486357_1274 from any node:java.io.IOException: No live nodes contain current block
10/01/11 10:55:02 INFO hdfs.DFSClient: No node available for block: blk_4128181309487486357_1274 file=/hello.txt
10/01/11 10:55:02 INFO hdfs.DFSClient: Could not obtain block blk_4128181309487486357_1274 from any node:java.io.IOException: No live nodes contain current block
10/01/11 10:55:05 INFO hdfs.DFSClient: No node available for block: blk_4128181309487486357_1274 file=/hello.txt
10/01/11 10:55:05 INFO hdfs.DFSClient: Could not obtain block blk_4128181309487486357_1274 from any node:java.io.IOException: No live nodes contain current block
10/01/11 10:55:08 WARN hdfs.DFSClient: DFS Read: java.io.IOException: Could not obtain block: blk_4128181309487486357_1274 file=/hello.txt
      at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.chooseDataNode(DFSClient.java:1757)
      at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.blockSeekTo(DFSClient.java:1585)
      at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.read(DFSClient.java:1712)
      at java.io.DataInputStream.read(Unknown Source)
      at org.apache.hadoop.io.IOUtils.copyBytes(IOUtils.java:47)
      at org.apache.hadoop.io.IOUtils.copyBytes(IOUtils.java:85)
      at org.apache.hadoop.fs.FsShell.printToStdout(FsShell.java:114)
      at org.apache.hadoop.fs.FsShell.access$100(FsShell.java:49)
      at org.apache.hadoop.fs.FsShell$1.process(FsShell.java:352)
      at org.apache.hadoop.fs.FsShell$DelayedExceptionThrowing.globAndProcess(FsShell.java:1866)
      at org.apache.hadoop.fs.FsShell.cat(FsShell.java:346)
      at org.apache.hadoop.fs.FsShell.doall(FsShell.java:1513)
      at org.apache.hadoop.fs.FsShell.run(FsShell.java:1729)
      at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
      at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
      at org.apache.hadoop.fs.FsShell.main(FsShell.java:1848)
cat: Could not obtain block: blk_4128181309487486357_1274 file=/hello.txt
错误原因:
DataNode没有起来

处理措施:

进一步检查日志,查看为什么没有将DataNode拉起来。比如是不是主机名错误,在Hadoop中,请注意主机名不要包含有下划线“_”,但可以有 横线“-”。还可以检查下hostname命令的输出和/etc/hosts的配置是否相同,有可能是hostname输出的主机名中包含有下划线。
在SuSE中,存在一个/etc/HOSTNAME文件,它的内容只有一行,就是hostname返回的主机名。

when30 发表于 2013-10-25 10:44:58

block的丢失也会导致这个错误

为梦狂野 发表于 2016-12-21 12:21:46

我发现我的datanode成功启动了,但是依然报了这个错误
页: [1]
查看完整版本: Could not obtain block错误