I cannot transfer the file to Hadoop. Below I add the commands that I have used and the obtained error.
Command 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)
Command 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"}}
See second step to creating a file
curl -i -X PUT -T <LOCAL_FILE>
You're missing a -T
, and it's taking your file as a URL, which is malformed, therefore the error