一.问题描述:
[root@master sbin]# hdfs dfsadmin -report
Configured Capacity: 0 (0 B)
Present Capacity: 0 (0 B)
DFS Remaining: 0 (0 B)
DFS Used: 0 (0 B)
DFS Used%: NaN%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0
Pending deletion blocks: 0
二.问题导致可能原因:
1)多次格式化导致的,可以尝试删除hdfs下的data目录、name目录、tmp目录后格式,然后重新启动;
2)没有关闭防火墙,可以通过以下命令检查是否关闭了防火墙,如果没有关闭先关闭对应节点的防火墙
[root@slave1 data]# service iptables status
iptables: Firewall is not running.
3)不在同一个网络,需要相互ping通
4)检查namenode节点上的cat /etc/hosts下有没有注释127.0.0.1映射表,如果没有先注释再重新启动
[root@master hadoop-3.0.0-alpha4]# cat /etc/hosts
127.0.0.1 master localhost
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.28.130 www
192.168.28.130 master
192.168.28.136 slave1
192.168.28.137 slave2
发现有127.0.0.1映射,先注释掉再启动hadoop相关服务
[root@master sbin]# ./start-all.sh
Starting namenodes on [master]
Starting datanodes
Starting secondary namenodes [master]
Starting resourcemanager
Starting nodemanagers
三.问题解决后,运行结果如下:
[root@master sbin]# hdfs dfsadmin -report
Configured Capacity: 202921664512 (188.99 GB)
Present Capacity: 166830989312 (155.37 GB)
DFS Remaining: 166830940160 (155.37 GB)
DFS Used: 49152 (48 KB)
DFS Used%: 0.00%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0
Pending deletion blocks: 0
-------------------------------------------------
Live datanodes (2):
Name: 192.168.28.136:9866 (slave1)
Hostname: slave1
Decommission Status : Normal
Configured Capacity: 101460832256 (94.49 GB)
DFS Used: 24576 (24 KB)
Non DFS Used: 12891869184 (12.01 GB)
DFS Remaining: 83415031808 (77.69 GB)
DFS Used%: 0.00%
DFS Remaining%: 82.21%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Thu Jun 07 10:52:01 CST 2018
Last Block Report: Thu Jun 07 10:51:14 CST 2018
Name: 192.168.28.137:9866 (slave2)
Hostname: slave2
Decommission Status : Normal
Configured Capacity: 101460832256 (94.49 GB)
DFS Used: 24576 (24 KB)
Non DFS Used: 12890992640 (12.01 GB)
DFS Remaining: 83415908352 (77.69 GB)
DFS Used%: 0.00%
DFS Remaining%: 82.21%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Thu Jun 07 10:52:01 CST 2018
Last Block Report: Thu Jun 07 10:51:14 CST 2018