Support Questions

Find answers, ask questions, and share your expertise

Could not resolve host: sandbox.hortonworks.com when trying to upload a file.

avatar
Contributor

I try to upload a file to hdfs through webHDFS . Before file update i made a directory with webHDFS, "testDIR" in /tmp/testDIR and it works.

First command is :

 curl -i -X PUT "http://192.168.1.112:50070/webhdfs/v1/tmp/testDIR/test.txt?op=CREATE"

For the second command i'll use url from "Location" as in the instructions.

Second commnd :

curl -i -X PUT -T test.txt "http://sandbox.hortonworks.com:50075/webhdfs/v1/tmp/testDIR/test.txt?op=CREATE&namenoderpcaddress=sandbox.hortonworks.com:8020&createflag=&createparent=true&overwrite=false".

This command response is : "

Could not resolve host: sandbox.hortonworks.com

What can i do ?

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Mihai Morareanu use the IP address url that worked or add sandbox.hortonworks.com to /etc/hosts.

View solution in original post

6 REPLIES 6

avatar
Master Mentor

@Mihai Morareanu use the IP address url that worked or add sandbox.hortonworks.com to /etc/hosts.

avatar
Contributor

@Artem Ervits sandbox.hortonworks.com it's already in /etc/hosts and the URL is the same as in directory creation request. Do you have other sugestions?

avatar
Master Mentor

@Mihai Morareanu as a good practice, when you are satisfied with an answer, please click accept to close out a thread.

avatar
Master Mentor
@Mihai Morareanu

your webhdfs Port is different between two commands.

avatar
Contributor

The port must be different . Finnaly i can upload files. After the first call you must take what is in the "Location" parameter of the response and make another call with the file (-T file) but instead of "sandbox.hortonworks.com" you must use machine ip.

Here is an example:

****************************

curl -i -X PUT "http://192.168.1.113:50070/webhdfs/v1/tmp/testDIR/test.txt?op=CREATE&user.name=hdfs"

*****************************

HTTP/1.1 307 TEMPORARY_REDIRECT
Cache-Control: no-cache
Expires: Mon, 11 Jan 2016 19:02:58 GMT
Date: Mon, 11 Jan 2016 19:02:58 GMT
Pragma: no-cache
Expires: Mon, 11 Jan 2016 19:02:58 GMT
Date: Mon, 11 Jan 2016 19:02:58 GMT
Pragma: no-cache
Set-Cookie: hadoop.auth="u=hdfs&p=hdfs&t=simple&e=1452574978370&s=wWMnpbCQCrLuYr
SO5ViO6Vt8rzw="; Path=/; Expires=Tue, 12-Jan-2016 05:02:58 GMT; HttpOnly
Location: http://sandbox.hortonworks.com:50075/webhdfs/v1/tmp/testDIR/test.txt?o
p=CREATE&user.name=hdfs&namenoderpcaddress=sandbox.hortonworks.com:8020&createfl
ag=&createparent=true&overwrite=false
Content-Type: application/octet-stream
Content-Length: 0
Server: Jetty(6.1.26.hwx)

********************************************

C:\Users\...\Desktop>curl -i -X PUT -T test.txt "http://192.168.1.113:50075/webhdfs/v1/tmp/testDIR/test.txt?op=CREATE&user.name=hdfs&namenoderpcaddress=sandbox.hortonworks.com:8020&createflag=&createparent=true&overwrite=false"
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Location: hdfs://sandbox.hortonworks.com:8020/tmp/testDIR/test.txt
Content-Length: 0
Connection: close

avatar
Master Mentor
@Mihai Morareanu

glad it worked for you, please accept one of the valid answers to close out the thread.