Reputation: 991
I have not been able to create a file using Hadoop's WebHDFS REST API.
Following the docs, I'm doing this.
curl -i -X PUT "http://hadoop-primarynamenode:50070/webhdfs/v1/tmp/test1234?op=CREATE&overwrite=false"
Response:
HTTP/1.1 307 TEMPORARY_REDIRECT
Cache-Control: no-cache
Expires: Fri, 15 Jul 2016 04:10:13 GMT
Date: Fri, 15 Jul 2016 04:10:13 GMT
Pragma: no-cache
Expires: Fri, 15 Jul 2016 04:10:13 GMT
Date: Fri, 15 Jul 2016 04:10:13 GMT
Pragma: no-cache
Content-Type: application/octet-stream
Location: http://hadoop-datanode1:50075/webhdfs/v1/tmp/test1234?op=CREATE&namenoderpcaddress=hadoop-primarynamenode:8020&overwrite=false
Content-Length: 0
Server: Jetty(6.1.26)
Following the redirect:
curl -i -X PUT -T MYFILE "http://hadoop-datanode1:50075/webhdfs/v1/tmp/test1234?op=CREATE&namenoderpcaddress=hadoop-primarynamenode:8020"
Response:
HTTP/1.1 100 Continue
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Content-Length: 162
Connection: close
{"RemoteException":{"exception":"IllegalArgumentException","javaClassName":"java.lang.IllegalArgumentException","message":"Failed to parse \"null\" to Boolean."}}
I could not find any leads for that error message. Has anyone experienced this before?
I'm running a Hadoop cluster installed using Ambari.
Upvotes: 1
Views: 1335
Reputation: 991
Seems like the second PUT command requires a "createparent" parameter. In fact, both "overwrite" and "createparent" are needed. WebHDFS is not using default values. Definitely a bug...
curl -i -X PUT -T MYFILE "http://hadoop-datanode1:50075/webhdfs/v1/tmp/test1234?op=CREATE&namenoderpcaddress=hadoop-primarynamenode:8020&overwrite=false&createparent=false"
Upvotes: 0