0
votes

I'm new to Hadoop, and it take me one week to find webHDFS, which I think can help me show the FileSystem out of the cluster. I can view the filesystem in "http://master:50070/webhdfs/v1/user/hadoop?user.name=hadoopes&op=LISTSTATUS", however, it shows,

{"FileStatuses":{"FileStatus":[ {"accessTime":0,"blockSize":0,"group":"supergroup","length":0,"modificationTime":1337823103411,"owner":"hadoop","pathSuffix":"Yijin","permission":"777","replication":0,"type":"DIRECTORY"}, {"accessTime":1337824794722,"blockSize":67108864,"group":"supergroup","length":11,"modificationTime":1337751080433,"owner":"pc","pathSuffix":"hello.txt","permission":"644","replication":2,"type":"FILE"}, {"accessTime":0,"blockSize":0,"group":"supergroup","length":0,"modificationTime":1337848266732,"owner":"hadoop","pathSuffix":"test","permission":"755","replication":0,"type":"DIRECTORY"}, {"accessTime":1337824798450,"blockSize":67108864,"group":"supergroup","length":18,"modificationTime":1337751301976,"owner":"pc","pathSuffix":"test2.txt","permission":"644","replication":2,"type":"FILE"}, {"accessTime":0,"blockSize":0,"group":"supergroup","length":0,"modificationTime":1337821412488,"owner":"hadoop","pathSuffix":"small","permission":"777","replication":0,"type":"DIRECTORY"} ]}}

it's very hard to read. Is there any other way to view the filesystem by webHDFS, and this is my "hdfs-site.xml"

<property>
    <name>dfs.replication</name>
    <value>2</value>
</property>
<property>
    <name>dfs.name.dir</name>
    <value>/home/hadoop/hdfs/name</value>
</property>
<property>
    <name>dfs.data.dir</name>
    <value>/home/hadoop/hdfs/data</value>
</property>
<property>
    <name>dfs.webhdfs.enabled</name>
    <value>true</value>
</property>
2

2 Answers

0
votes

webHDFS returns all its content in JSON format, if you want a user friendly output format just point your browser to http://master:50070/ and drill down from there

0
votes

You can build a Class that follows the JSON schema of the object returned by the LISTSTATUS operation. Use a mapper (e.g. Jackson ObjectMapper) to read the JSON and to convert it to your Class object. Finally you can prompt it as you wish!