[root@hadoop test]# hadoop jar hadoop.jarcom.hadoop.hdfs.CopyToHDFS
14/01/26 10:20:00 WARN hdfs.DFSClient: DataStreamerException: org.apache.hadoop.ipc.RemoteException: java.io.IOException: File/user/hadoop/test/01/hello.
txt could only be replicated to 0 nodes, instead of1
atorg.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:1639)
atorg.apache.hadoop.hdfs.server.namenode.NameNode.addBlock(NameNode.java:736)
atsun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
14/01/26 10:20:00 WARN hdfs.DFSClient: Error Recoveryfor block null bad datanode[0] nodes == null
14/01/26 10:20:00 WARN hdfs.DFSClient: Could not getblock locations. Source file "/user/hadoop/test/01/hello.txt" -Aborting...
Exception in thread "main"org.apache.hadoop.ipc.RemoteException: java.io.IOException: File/user/hadoop/test/01/hello.txt could only be replicated to 0
nodes, instead of1
atorg.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:1639)
atorg.apache.hadoop.hdfs.server.namenode.NameNode.addBlock(NameNode.java:736)
atsun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14/01/26 10:20:00 ERROR hdfs.DFSClient: Failed to closefile /user/hadoop/test/01/hello.txt
org.apache.hadoop.ipc.RemoteException:java.io.IOException: File /user/hadoop/test/01/hello.txt could only bereplicated to 0 nodes, instead of 1
atorg.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:1639)
atorg.apache.hadoop.hdfs.server.namenode.NameNode.addBlock(NameNode.java:736)
atsun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
ient.java:2989)
2.原因及解决方案:
原因:
多次格式化hadoop导致版本信息不一致,修改为一致状态即可解决问题
解决
1、先把服务都停掉 stop-all.sh
2、格式化namenode hadoop namenode -foramt
3、重新启动所有服务 start-all.sh
4、可以进行正常操作了
--转自