hadoop webhdfs创建。我无法传输文件

时间:2018-04-18 12:12:03

标签: hadoop webhdfs

我无法将文件传输到Hadoop。下面我添加我使用的命令和获得的错误。

命令1:

curl -i -X PUT "http://myip:50070/webhdfs/v1/tmp/tempForTest.txt?user.name=hadoop&op=CREATE&overwrite=false&createparent=false&replication=1&permission=777"

HTTP/1.1 307 TEMPORARY_REDIRECT
Cache-Control: no-cache
Expires: Wed, 18 Apr 2018 11:53:28 GMT
Date: Wed, 18 Apr 2018 11:53:28 GMT
Pragma: no-cache
Expires: Wed, 18 Apr 2018 11:53:28 GMT
Date: Wed, 18 Apr 2018 11:53:28 GMT
Pragma: no-cache
Set-Cookie: hadoop.auth="u=hadoop&p=hadoop&t=simple&e=1524088408729&s=A7TeYalAbDREoOHiJjh4YQZEhyk="; Path=/; Expires=Wed, 18-Apr-2018 21:53:28 GMT; HttpOnly
Location: http://hadoop-3:50075/webhdfs/v1/tmp/tempForTest.txt?op=CREATE&user.name=hadoop&namenoderpcaddress=hadoop-1:9000&overwrite=false&permission=777&replication=1
Content-Type: application/octet-stream
Content-Length: 0
Server: Jetty(6.1.26)

命令2:

curl -i -X PUT /usr/local/hadoop-2.7.5/etc/hadoop/tmp/tempForTest.txt "http://hadoop-3:50075/webhdfs/v1/tmp/tempForTest.txt?user.name=hadoop&op=CREATE&overwrite=false&createparent=false&replication=1&permission=777"

curl: (3) <url> malformed
HTTP/1.1 100 Continue
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Content-Length: 161
Connection: close
{"RemoteException":{"exception":"IllegalArgumentException","javaClassName":"java.lang.IllegalArgumentException","message":"java.net.UnknownHostException: null"}}

1 个答案:

答案 0 :(得分:1)

请参阅second step to creating a file

curl -i -X PUT -T <LOCAL_FILE> 

您错过了-T,并且将您的文件作为网址,这是错误的,因此错误