myeclipse下执行程序报错IO异常。hadoop查看也报错的解决。

$ bin/hadoop fs -cat /tmp/wordcount/word.txt
12/06/29 18:07:53 INFO hdfs.DFSClient: No node available for block: blk_-6169034246478912245_1004 file=/tmp/wordcount/word.txt
12/06/29 18:07:53 INFO hdfs.DFSClient: Could not obtain block blk_-6169034246478912245_1004 from any node:  java.io.IOException: No live nodes contain current block
12/06/29 18:07:56 INFO hdfs.DFSClient: No node available for block: blk_-6169034246478912245_1004 file=/tmp/wordcount/word.txt
12/06/29 18:07:56 INFO hdfs.DFSClient: Could not obtain block blk_-6169034246478912245_1004 from any node:  java.io.IOException: No live nodes contain current block
12/06/29 18:07:59 INFO hdfs.DFSClient: No node available for block: blk_-6169034246478912245_1004 file=/tmp/wordcount/word.txt
12/06/29 18:07:59 INFO hdfs.DFSClient: Could not obtain block blk_-6169034246478912245_1004 from any node:  java.io.IOException: No live nodes contain current block
12/06/29 18:08:02 WARN hdfs.DFSClient: DFS Read: java.io.IOException: Could not obtain block: blk_-6169034246478912245_1004 file=/tmp/wordcount/word.txt
        at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.chooseDataNode(DFSClient.java:1812)
        at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.blockSeekTo(DFSClient.java:1638)
        at org.apache.hadoop.hdfs.DFSClient$DFSInputStream.read(DFSClient.java:1767)
        at java.io.DataInputStream.read(DataInputStream.java:83)
        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:1898)
        at org.apache.hadoop.fs.FsShell.cat(FsShell.java:346)
        at org.apache.hadoop.fs.FsShell.doall(FsShell.java:1543)
        at org.apache.hadoop.fs.FsShell.run(FsShell.java:1761)
        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:1880)


cat: Could not obtain block: blk_-6169034246478912245_1004 file=/tmp/wordcount/word.txt

解决方法:将hadoop关闭重启。

$ bin/stop-all.sh

$ bin/start-all.sh

$ bin/hadoop fs -ls /tmp/wordcount/

$ bin/hadoop fs -cat  /tmp/wordcount/word.txt


这次就ok了。

你可能感兴趣的:(hadoop,IO,MyEclipse,File)