WEBHDFS是一个基于REST的接口。可以查看文件系统,以及文件的内容:
在hdfs-site.xml中配置:
<property>
<name>dfs.namenode.http-address</name>
<value>Hadoop:50070</value> //这个可以不用配置
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
启动之后,可以看使用如下命令检测,
获得目录的列表:
[hadoop@Hadoop hadoop]$ curl -i "http://Hadoop:50070/webhdfs/v1/?user.name=hadoop&op=LISTSTATUS"
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 225
Server: Jetty(6.1.26.cloudera.2)
{"FileStatuses":{"FileStatus":[
{"accessTime":0,"blockSize":0,"group":"supergroup","length":0,"modificationTime":1359886700728,"owner":"hadoop","pathSuffix":"hadoop","permission":"755","replication":0,"type":"DIRECTORY"}
其中:REST http的格式为:
http://<HOST>:<HTTP_PORT>/webhdfs/v1/<PATH>? [user.name=<USER>&]op=..
具体参照:WebHDFS.html。offline的地址:在hadoop解压之后目录doc下面的/doc/hadoop-yarn/hadoop-yarn-site/WebHDFS.html