使用webhdfs rest api创建文件时发生remoteexception

vc9ivgsu  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(313)

我无法使用hadoop的webhdfs restapi创建文件。
跟着医生,我在做这个。

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集群。

ecr0jaav

ecr0jaav1#

似乎第二个put命令需要一个“createparent”参数。实际上,需要“overwrite”和“createparent”。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"

相关问题