Simple use of hdfshttpfs and webhdfs

Source: Internet
Author: User
HttpFS and WebHDFS have two components for operating hdfs through the http protocol: httpfs and webhdfs. At first I thought these two were the same thing, but they were not. Webhdfs comes with namenode and datanode, and httpfs is a completely independent component. To upload files through webhdfs, you must use a datanode instead of using namen directly.

HttpFS and WebHDFS have two components for operating hdfs through the http protocol: httpfs and webhdfs. At first I thought these two were the same thing, but they were not. Webhdfs comes with namenode and datanode, and httpfs is a completely independent component. To upload files through webhdfs, you must use a datanode instead of using namen directly.

HttpFS and WebHDFS

There are two components for operating hdfs through the http protocol: httpfs and webhdfs. At first I thought these two were the same thing, but they were not. Webhdfs comes with namenode and datanode, and httpfs is a completely independent component.

To upload files through webhdfs, you must use a datanode instead of using namenode. The client may access multiple machines. And httpfs, all operations are performed through httpfs.

The use of webhdfs and httpfs is basically the same, with only a small difference.

HttpFS Common Operations

View home Directory
Curl & quot; http: // osg11-vm06: 8014/webhdfs/v1? Op = GETHOMEDIRECTORY & user. name = kpi"

Create directory
Curl-I-X PUT "http: // osg11-vm06: 8014/webhdfs/v1/tmp/chenyk? Op = MKDIRS & user. name = kpi"

Curl-I-x put "http: // osg11-vm06: 8014/webhdfs/v1/tmp/chenyk/a/B/c? Op = MKDIRS & user. name = kpi"

Delete directory. The recursive Parameter deletes non-empty directories.
Curl-I-X DELETE "http: // osg11-vm06: 8014/webhdfs/v1/tmp/chenyk/? Op = DELETE & recursive = true & user. name = kpi"

Creating a file (httpfs does not make sense to execute this step, and the upload is also done through httpfs)
Curl-I-X PUT "http: // osg11-vm06: 8014/webhdfs/v1/tmp/chenyk/test? Op = CREATE & user. name = kpi"

Create and upload files
Add the header here, otherwise an error is prompted, it may be a bug https://issues.cloudera.org/browse/HUE-679

Curl-I-X PUT-T/tmp/test.txt "http: // osg11-vm06: 8014/webhdfs/v1/tmp/chenyk/test? Op = CREATE & data = true & user. name = kpi "-H" Content-Type: application/octet-stream"

Append a file
Curl-I-X POST-T/tmp/test.txt "http: // osg11-vm06: 8014/webhdfs/v1/tmp/chenyk/test? Op = APPEND & data = true & user. name = kpi "-H" Content-Type: application/octet-stream"

Open the file and read it
Curl-I-L "http: // osg11-vm06: 8014/webhdfs/v1/tmp/chenyk/test? Op = OPEN & user. name = kpi"

Reference

Http://hadoop.apache.org/docs/r1.0.4/webhdfs.html

Original article address: simple use of hdfs httpfs and webhdfs, thanks to the original author for sharing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.