Hi Arvind,
Check the source code in DFSAdmin which handles dfsadmin -report. It uses
the same API that the namenode web UI does - I think it's called
getClusterStatus or something if my memory serves me correctly. Here's
example output on my pseudodistributed cluster:

Datanodes available: 1 (1 total, 0 dead)

Name: 127.0.0.1:50010
Decommission Status : Normal
Configured Capacity: 37265149952 (34.71 GB)
DFS Used: 1556480 (1.48 MB)
Non DFS Used: 29779308544 (27.73 GB)
DFS Remaining: 7484284928(6.97 GB)
DFS Used%: 0%
DFS Remaining%: 20.08%
Last contact: Fri Aug 21 13:33:53 PDT 2009

-Todd

2009/8/21 zjffdu <[email protected]>

> Arvind,
>
> You can use this API to get the size of file system used
>
> FileSystem.getUsed();
>
>
> But, I do not find the API for calculate the remaining space. You can write
> some code to create a API,
>
> The remaining disk space = Total of disk space - operate system space -
> FileSystem.getUsed()
>
>
>
> -----Original Message-----
> From: Arvind Sharma [mailto:[email protected]]
> Sent: 2009年8月20日 16:45
> To: [email protected]
> Subject: Re: Cluster Disk Usage
>
> Sorry, I also sent a direct e-mail to one response....
>
> there I asked one question - what is the cost of these APIs ???  Are they
> too expensive calls ?  Is the API only going to the NN which stores this
> data ?
>
> Thanks!
> Arvind
>
>
>
>
> ________________________________
> From: Arvind Sharma <[email protected]>
> To: [email protected]
> Sent: Thursday, August 20, 2009 4:01:02 PM
> Subject: Re: Cluster Disk Usage
>
> Using hadoop-0.19.2
>
>
>
>
> ________________________________
> From: Arvind Sharma <[email protected]>
> To: [email protected]
> Sent: Thursday, August 20, 2009 3:56:53 PM
> Subject: Cluster Disk Usage
>
> Is there a way to find out how much disk space - overall or per Datanode
> basis - is available before creating a file ?
>
> I am trying to address an issue where the disk got full (config error) and
> the client was not able to create a file on the HDFS.
>
> I want to be able to check if  there space left on the grid before trying
> to
> create the file.
>
> Arvind
>
>
>
>
>

Reply via email to