Ubuntu 12.04 上使用Hadoop 2.2.0(7)

Hadoop dfsadmin是命令行的管理工具,查看帮助用如下命令:

hadoop dfsadmin -help

所以dfsadmin是hadoop程序的一个参数,而不是独立的工具。不过现在版本有点变化,hadoop dfsadmin的用法已经被废止,改为hdfs dfsadmin命令。

下面是查看简单的报告:

hduser@namenode:~$ hdfs dfsadmin -report
Configured Capacity: 295283847168 (275.00 GB)
Present Capacity: 267895083008 (249.50 GB)
DFS Remaining: 267894972416 (249.50 GB)
DFS Used: 110592 (108 KB)
DFS Used%: 0.00%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0

-------------------------------------------------
Datanodes available: 3 (3 total, 0 dead)

Live datanodes:
Name: 192.168.1.73:50010 (datanode1)
Hostname: datanode1
Decommission Status : Normal
Configured Capacity: 98427949056 (91.67 GB)
DFS Used: 36864 (36 KB)
Non DFS Used: 9129578496 (8.50 GB)
DFS Remaining: 89298333696 (83.17 GB)
DFS Used%: 0.00%
DFS Remaining%: 90.72%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Last contact: Mon Mar 10 03:09:14 UTC 2014


Name: 192.168.1.75:50010 (datanode3)
Hostname: datanode3
Decommission Status : Normal
Configured Capacity: 98427949056 (91.67 GB)
DFS Used: 36864 (36 KB)
Non DFS Used: 9129590784 (8.50 GB)
DFS Remaining: 89298321408 (83.17 GB)
DFS Used%: 0.00%
DFS Remaining%: 90.72%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Last contact: Mon Mar 10 03:09:16 UTC 2014


Name: 192.168.1.74:50010 (datanode2)
Hostname: datanode2
Decommission Status : Normal
Configured Capacity: 98427949056 (91.67 GB)
DFS Used: 36864 (36 KB)
Non DFS Used: 9129594880 (8.50 GB)
DFS Remaining: 89298317312 (83.17 GB)
DFS Used%: 0.00%
DFS Remaining%: 90.72%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Last contact: Mon Mar 10 03:09:14 UTC 2014

下面的这个命令可以打印出拓扑结构:

hduser@namenode:~$ hdfs dfsadmin -printTopology
Rack: /default-rack
  192.168.1.73:50010 (datanode1)
  192.168.1.74:50010 (datanode2)
  192.168.1.75:50010 (datanode3)

rack指的是机架,目前三台datanode虚拟机位于一个物理主机上,所以都是default-rack。以后应该要演化成多个rack上的配置。可以用一个物理机模拟一个rack。

详细参考官方文档:

#dfsadmin

下面这个命令参数很有用,可以在HDFS集群运行时增加新的datanode后,让namenode重新读取配置文件里面的hosts列表。

-refreshNodes   Re-read the hosts and exclude files to update the set of Datanodes that are allowed to connect to the Namenode and those that should be decommissioned or recommissioned.  

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/051ce98a7da1aa24ae95281644219320.html