0

我是 Hadoop 的新手,我花了一周的时间找到了 webHDFS,我认为这可以帮助我将 FileSystem 展示出集群。我可以在“http://master:50070/webhdfs/v1/user/hadoop?user.name=hadoopes&op=LISTSTATUS”中查看文件系统,但是它显示,

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

很难阅读。有没有其他方法可以通过 webHDFS 查看文件系统,这是我的“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>
4

2 回答 2

0

webHDFS 以 JSON 格式返回其所有内容,如果您想要用户友好的输出格式,只需将浏览器指向http://master:50070/并从那里向下钻取

于 2012-05-24T10:55:23.187 回答
0

您可以构建一个遵循 LISTSTATUS 操作返回的对象的 JSON 模式的类。使用映射器(例如 Jackson ObjectMapper)读取 JSON 并将其转换为您的 Class 对象。终于可以随心所欲的提示了!

于 2015-11-30T09:32:04.930 回答