This is an automated email from the ASF dual-hosted git repository.
zitadombi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new d4e7d94239a HDDS-13167. Add example for uploading file via HttpFS
(#9175)
d4e7d94239a is described below
commit d4e7d94239ab709841353bf411bb11c9feea5a85
Author: Eric Chang <[email protected]>
AuthorDate: Wed Oct 29 21:56:49 2025 +0800
HDDS-13167. Add example for uploading file via HttpFS (#9175)
---
hadoop-hdds/docs/content/interface/HttpFS.md | 98 ++++++++++++++++++++++++----
1 file changed, 87 insertions(+), 11 deletions(-)
diff --git a/hadoop-hdds/docs/content/interface/HttpFS.md
b/hadoop-hdds/docs/content/interface/HttpFS.md
index cebe0d315b0..a4eb7271a11 100644
--- a/hadoop-hdds/docs/content/interface/HttpFS.md
+++ b/hadoop-hdds/docs/content/interface/HttpFS.md
@@ -45,24 +45,102 @@ HttpFS has built-in security supporting Hadoop pseudo
authentication and Kerbero
HttpFS service itself is a Jetty based web-application that uses the Hadoop
FileSystem API to talk to the cluster, it is a separate service which provides
access to Ozone via a REST APIs. It should be started in addition to other
regular Ozone components.
-To try it out, you can start a Docker Compose dev cluster that has an HttpFS
gateway.
+To try it out, follow the instructions from the link below to start the Ozone
cluster with Docker Compose.
-Extract the release tarball, go to the `compose/ozone` directory and start the
cluster:
+https://ozone.apache.org/docs/edge/start/startfromdockerhub.html
```bash
-docker-compose up -d --scale datanode=3
+docker compose up -d --scale datanode=3
```
-You can/should find now the HttpFS gateway in docker with the name
`ozone_httpfs`.
-HttpFS HTTP web-service API calls are HTTP REST calls that map to an Ozone
file system operation. For example, using the `curl` Unix command.
+You can/should find now the HttpFS gateway in docker with the name like
`ozone_httpfs`,
+and it can be accessed through `localhost:14000`.
+HttpFS HTTP web-service API calls are HTTP REST calls that map to an Ozone
file system operation.
-E.g. in the docker cluster you can execute commands like these:
+Here's some example usage:
-* `curl -i -X PUT
"http://httpfs:14000/webhdfs/v1/vol1?op=MKDIRS&user.name=hdfs"` creates a
volume called `vol1`.
+### Create a volume
+```bash
+# creates a volume called `volume1`.
+curl -i -X PUT
"http://localhost:14000/webhdfs/v1/volume1?op=MKDIRS&user.name=hdfs"
+```
+
+Example Output:
+
+```bash
+HTTP/1.1 200 OK
+Date: Sat, 18 Oct 2025 07:51:21 GMT
+Cache-Control: no-cache
+Expires: Sat, 18 Oct 2025 07:51:21 GMT
+Pragma: no-cache
+Content-Type: application/json
+X-Content-Type-Options: nosniff
+X-XSS-Protection: 1; mode=block
+Set-Cookie:
hadoop.auth="u=hdfs&p=hdfs&t=simple-dt&e=1760809881100&s=OCdVOi8eyMguFySkmEJxm5EkRfj6NbAM9agi5Gue1Iw=";
Path=/; HttpOnly
+Content-Length: 17
+
+{"boolean":true}
+```
+
+### Create a bucket
+
+```bash
+# creates a bucket called `bucket1`.
+curl -i -X PUT
"http://localhost:14000/webhdfs/v1/volume1/bucket1?op=MKDIRS&user.name=hdfs"
+```
+
+Example Output:
+
+```bash
+HTTP/1.1 200 OK
+Date: Sat, 18 Oct 2025 07:52:06 GMT
+Cache-Control: no-cache
+Expires: Sat, 18 Oct 2025 07:52:06 GMT
+Pragma: no-cache
+Content-Type: application/json
+X-Content-Type-Options: nosniff
+X-XSS-Protection: 1; mode=block
+Set-Cookie:
hadoop.auth="u=hdfs&p=hdfs&t=simple-dt&e=1760809926682&s=yvOaeaRCVJZ+z+nZQ/rM/Y01pzEmS9Pe2mE9f0b+TWw=";
Path=/; HttpOnly
+Content-Length: 17
+
+{"boolean":true}
+```
+
+### Upload a file
-* `$ curl
'http://httpfs-host:14000/webhdfs/v1/user/foo/README.txt?op=OPEN&user.name=foo'`
returns the content of the key `/user/foo/README.txt`.
+```bash
+echo "hello" >> ./README.txt
+curl -i -X PUT
"http://localhost:14000/webhdfs/v1/volume1/bucket1/user/foo/README.txt?op=CREATE&data=true&user.name=hdfs"
-T ./README.txt -H "Content-Type: application/octet-stream"
+```
+Example Output:
+
+```bash
+HTTP/1.1 100 Continue
+
+HTTP/1.1 201 Created
+Date: Sat, 18 Oct 2025 08:33:33 GMT
+Cache-Control: no-cache
+Expires: Sat, 18 Oct 2025 08:33:33 GMT
+Pragma: no-cache
+X-Content-Type-Options: nosniff
+X-XSS-Protection: 1; mode=block
+Set-Cookie:
hadoop.auth="u=hdfs&p=hdfs&t=simple-dt&e=1760812413286&s=09t7xKu/p/fjCJiQNL3bvW/Q7mTw28IbeNqDGlslZ6w=";
Path=/; HttpOnly
+Location: http://localhost:14000/webhdfs/v1/volume1/bucket1/user/foo/README.txt
+Content-Type: application/json
+Content-Length: 84
+
+{"Location":"http://localhost:14000/webhdfs/v1/volume1/bucket1/user/foo/README.txt"}
+```
+
+### Read the file content
+
+```bash
+# returns the content of the key `/user/foo/README.txt`.
+curl
'http://localhost:14000/webhdfs/v1/volume1/bucket1/user/foo/README.txt?op=OPEN&user.name=foo'
+hello
+```
## Supported operations
@@ -110,10 +188,8 @@ Set ACL | not implemented in
Ozone FileSystem API
Get ACL Status | not implemented in Ozone FileSystem API
Check access | not implemented in Ozone FileSystem API
-
-
## Hadoop user and developer documentation about HttpFS
* [HttpFS Server
Setup](https://hadoop.apache.org/docs/stable/hadoop-hdfs-httpfs/ServerSetup.html)
-* [Using HTTP
Tools](https://hadoop.apache.org/docs/stable/hadoop-hdfs-httpfs/ServerSetup.html)
\ No newline at end of file
+* [Using HTTP
Tools](https://hadoop.apache.org/docs/stable/hadoop-hdfs-httpfs/ServerSetup.html)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]