Hadoop:File xxx could only be replicated to 0 nodes, instead of 1

 

 近几日,重新搭建Hadoop,原本以为搭建成功,start-all.sh没有问题,hadoop fs -mkdir xxx / 命令也没有问题,当然删除命令也没有问题。但是put命令就会出错,报错如下:

[root@beth1 ~]# hadoop fs -put abc.txt /
11/10/18 19:27:03 WARN hdfs.DFSClient: DataStreamer Exception: org.apache.hadoop.ipc.RemoteException: java.io.IOException: File /abc.txt could only be replicated to 0 nodes, instead of 1
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:1267)
at org.apache.hadoop.hdfs.server.namenode.NameNode.addBlock(NameNode.java:422)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:508)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:959)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:955)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Unknown Source)

...

查看运行情况hadoop dfsadmin -report,发现可用节点是0:

[root@beth3 .ssh]# hadoop dfsadmin -report
Configured Capacity: 0 (0 KB)
Present Capacity: 0 (0 KB)
DFS Remaining: 0 (0 KB)
DFS Used: 0 (0 KB)
DFS Used%: ?%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0

所以,估计是datanode没有启动,于是将namenode节点也加入到slaves中,再次运行:

[root@beth3 conf]# hadoop dfsadmin -report
Configured Capacity: 12318588928 (11.47 GB)
Present Capacity: 8759939087 (8.16 GB)
DFS Remaining: 8759885824 (8.16 GB)
DFS Used: 53263 (52.01 KB)
DFS Used%: 0%
Under replicated blocks: 1
Blocks with corrupt replicas: 0
Missing blocks: 0

这次就明确了,datanode根本没有运行,去datanode上查看了运行服务的端口,发现没有50010,50060,50075等。

上网找了很多解决方法:

1、关闭datanode安全模式: hadoop dfsadmin -safemode leave

2、格式化datanode:hadoop namenode –format

3、datanode硬盘空间不够用 #df  -hl

4、...

一个一个的试试吧,总有一个会成功的! 

真没想到,自己写的第一篇hadoop文章竟然是解决问题...

希望碰到类似问题的朋友们早日看到我写的这篇帖子!Bless you!

如果以上解决方法仍不有效的,可以留言,本人必然回应!

 

阅读更多
文章标签: hadoop file exception
个人分类: Hadoop
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭