我无法使用Hadoop的WebHDFS REST API创建文件。
按照文档,我这样做。
curl -i -X PUT "http://hadoop-primarynamenode:50070/webhdfs/v1/tmp/test1234?op=CREATE&overwrite=false"
响应:
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)
重定向后:
curl -i -X PUT -T MYFILE "http://hadoop-datanode1:50075/webhdfs/v1/tmp/test1234?op=CREATE&namenoderpcaddress=hadoop-primarynamenode:8020"
响应:
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."}}
我找不到该错误消息的任何线索。有没有人经历过这个?
我正在运行使用Ambari安装的Hadoop群集。
答案 0 :(得分:0)
似乎第二个PUT命令需要" createparent"参数。事实上,两者都覆盖了#34;和"创建父母"是必要的。 WebHDFS未使用默认值。绝对是一个错误...
curl -i -X PUT -T MYFILE "http://hadoop-datanode1:50075/webhdfs/v1/tmp/test1234?op=CREATE&namenoderpcaddress=hadoop-primarynamenode:8020&overwrite=false&createparent=false"