学习 HDFS(十一):WebHDFS

栏目: 服务器 · 发布时间: 7年前

内容简介:除了 Hadoop 官方提供的基于 Java 的 Apache Hadoop HDFS Client 和基于 C 的 libhdfs 之外,HDFS 还提供了 REST API 操作 HDFS —— WebHDFS。显示 /data 文件夹状态:文件存在:

除了 Hadoop 官方提供的基于 Java 的 Apache Hadoop HDFS Client 和基于 C 的 libhdfs 之外,HDFS 还提供了 REST API 操作 HDFS —— WebHDFS。

操作

显示文件状态

显示 /data 文件夹状态:

curl -i "http://RESOURCE_MANAGER:50070/webhdfs/v1/data?op=GETFILESTATUS"

文件存在:

HTTP/1.1 200 OK  
Cache-Control: no-cache  
Expires: Tue, 25 Jun 2019 01:52:52 GMT  
Date: Tue, 25 Jun 2019 01:52:52 GMT  
Pragma: no-cache  
Expires: Tue, 25 Jun 2019 01:52:52 GMT  
Date: Tue, 25 Jun 2019 01:52:52 GMT  
Pragma: no-cache  
Content-Type: application/json  
Transfer-Encoding: chunked  
Server: Jetty(6.1.26.cloudera.4)

{"FileStatus":{"accessTime":0,"blockSize":0,"childrenNum":1,"fileId":23041928,"group":"dev","length":0,"modificationTime":1561427484230,"owner":"dyingbleed","pathSuffix":"","permission":"777","replication":0,"storagePolicy":0,"type":"DIRECTORY"}}

文件不存在:

HTTP/1.1 404 Not Found  
Cache-Control: no-cache  
Expires: Tue, 25 Jun 2019 01:52:33 GMT  
Date: Tue, 25 Jun 2019 01:52:33 GMT  
Pragma: no-cache  
Expires: Tue, 25 Jun 2019 01:52:33 GMT  
Date: Tue, 25 Jun 2019 01:52:33 GMT  
Pragma: no-cache  
Content-Type: application/json  
Transfer-Encoding: chunked  
Server: Jetty(6.1.26.cloudera.4)

{"RemoteException":{"exception":"FileNotFoundException","javaClassName":"java.io.FileNotFoundException","message":"File does not exist: /data"}}

参考


以上所述就是小编给大家介绍的《学习 HDFS(十一):WebHDFS》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Foundations of PEAR

Foundations of PEAR

Good, Nathan A./ Kent, Allan / Springer-Verlag New York Inc / 2006-11 / $ 50.84

PEAR, the PHP Extension and Application Repository, is a bountiful resource for any PHP developer. Within its confines lie the tools that you need to do your job more quickly and efficiently. You need......一起来看看 《Foundations of PEAR》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换