Get directory size from WebHDFS?

1.8k Views Asked by At

I see that webhdfs does not support directory size. In HDFS, I can use

hdfs dfs -du -s -h /my/directory

Is there a way to derive this from webHDFS? I need to do this programmatically, not by viewing the page.

1

There are 1 best solutions below

2
On BEST ANSWER

I think WebHDFS's GETCONTENTSUMMARY can provide you the information. More information here: http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Get_Content_Summary_of_a_Directory

Here is the schema for GETCONTENTSUMMARY: http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#ContentSummary_JSON_Schema

You'll see that it has the filed "spaceConsumed" which is the disk space consumed.