Unable to create a file using HttpFS Gateway #8548
-
|
Hello! I would appreciate some help with HttpFS Gateway. I would like to use it for a very simple use case where I need to create, read and delete files using REST API. I was able to read and delete a file using the API, but I am struggling with creation. I followed both the HttpFS Gateway and Hadoop documentation, but no luck. I tried some quick fixes, from changing the Docker image version to trying to create volumes and buckets in advance to trying to So, this is what I do. I start containers as per instructions and issue the request: curl -i -X PUT "http://localhost:14000/webhdfs/v1/exports/text/export.txt?op=CREATE&user.name=hadoop"The response looks good: Now I try to upload the actual file using the curl -i -X PUT -T ~/export.txt "http://localhost:14000/webhdfs/v1/exports/text/export.txt?op=CREATE&data=true&user.name=hadoop"And then I get As I said above, I tried different variations, like pre-creating volume and bucket, using different variants of the path, sending/not sending the I see nothing in the logs that could help me troubleshoot. I am just doing a quick evaluation, and I unfortunately haven't had time to go through detailed configuration. I was hoping that the examples in the documentation would work, but maybe some step is missing. Any help would be greatly appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
Beta Was this translation helpful? Give feedback.
-
|
@sasabrkic please try adding bash-5.1$ curl -i -X PUT -T ~/export.txt "http://httpfs:14000/webhdfs/v1/exports/text/export.txt?op=CREATE&data=true&user.name=hadoop"
HTTP/1.1 400 Bad Request
Pragma: no-cache
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Set-Cookie: hadoop.auth="u=hadoop&p=hadoop&t=simple-dt&e=1748970950712&s=sYBi468BlYTnfaZxqCMAiHbz+mJlMMGfKxXl90i34zo="; Path=/; HttpOnly
Connection: close
bash-5.1$ curl -i -X PUT -T ~/export.txt "http://httpfs:14000/webhdfs/v1/exports/text/export.txt?op=CREATE&data=true&user.name=hadoop" -H"Content-Type: application/octet-stream"
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Date: Tue, 03 Jun 2025 07:16:02 GMT
Cache-Control: no-cache
Expires: Tue, 03 Jun 2025 07:16:02 GMT
Pragma: no-cache
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Set-Cookie: hadoop.auth="u=hadoop&p=hadoop&t=simple-dt&e=1748970962918&s=IzhlonGJSDISkx9x3zZG5tVQAa0DBry76O61oJFvAp4="; Path=/; HttpOnly
Location: http://httpfs:14000/webhdfs/v1/exports/text/export.txt
Content-Type: application/json
Content-Length: 69
{"Location":"http://httpfs:14000/webhdfs/v1/exports/text/export.txt"}bash-5.1$ |
Beta Was this translation helpful? Give feedback.
-
|
@sasabrkic I'm able to create the file with: curl -v -X PUT -H "Content-Type: application/octet-stream" -T ~/export.txt "http://localhost:14000/webhdfs/v
1/exports/text/export.txt?op=CREATE&data=true&user.name=hadoop"
HTTP/1.1 201 Created
Date: Tue, 03 Jun 2025 07:09:19 GMT
Cache-Control: no-cache
Expires: Tue, 03 Jun 2025 07:09:19 GMT
Pragma: no-cache
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Set-Cookie: hadoop.auth="u=hadoop&p=hadoop&t=simple-dt&e=1748970559244&s=BpWb4ypcr2zQphg1BNnlvYDC9ul+SitU6UfLocAd4ao="; Path=/; HttpOnly
Location: http://localhost:14000/webhdfs/v1/exports/text/export.txt
Content-Type: application/json
Content-Length: 72
{"Location":"http://localhost:14000/webhdfs/v1/exports/text/export.txtI only add the header Looks like it's existing logic: |
Beta Was this translation helpful? Give feedback.
-
|
That solves the issue, thanks for the swift reply! I guess that the above should be mentioned somewhere in the documentation 😄 Keep up the good work, everybody! |
Beta Was this translation helpful? Give feedback.
-
|
Hi, I happen to be writing a Python client user doc, please help proof read it: I included the workarounds in the tutorial: |
Beta Was this translation helpful? Give feedback.
@sasabrkic please try adding
-H"Content-Type: application/octet-stream"to the "upload the actual file"curlcommand