1. 程式人生 > >上傳檔案到HDFS:錯誤:could only be replicated to 0 nodes, instead of 1

上傳檔案到HDFS:錯誤:could only be replicated to 0 nodes, instead of 1

上傳檔案到HDFS一直出現錯誤could only be replicated to 0 nodes, instead of 1,然後不能上傳檔案到HDFS。
遇到這種問題可能原因有:
1.slave機器上的datanode沒有開啟。
解決:
重啟叢集
重新格式化叢集
2.namenode執行在safemode下。
解決:
退出安全模式 hadoop dfsadmin -safemode leave
3.namenode所在的機器的防火牆沒有關閉
解決:
關閉防火牆

原因在於centos7
關閉 selinux 和 iptables 不行 要關閉動態防火牆
關閉防火牆:**

非常重要**
# systemctl status firewalld.service –檢視防火牆狀態
# systemctl stop firewalld.service –關閉防火牆
# systemctl disable firewalld.service –永久關閉防火牆

4.dfs的空間不足(我遇到的就是這種情況,因為在虛擬機器上搭建的hadoop平臺)
解決:
增加硬碟空間;參考:http://www.cnblogs.com/ljy2013/p/4620691.html
重新安裝虛擬機器,分配更大的硬碟空間