You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-user@hadoop.apache.org by 小学园PHP <xx...@qq.com> on 2013/03/20 04:32:52 UTC

Put a file to Hadoop with WebHDFS ?

When i use the WebHDFS, i wanna put a file to Hadoop.my curl command:
curl -i -X PUT -T /home/levi/3 "http://localhost:50070/webhdfs/v1/levi/3?op=CREATE"


But i got a return:
HTTP/1.1 100 Continue


HTTP/1.1 307 TEMPORARY_REDIRECT
Content-Type: application/octet-stream
Location: http://58.53.211.46:50075/webhdfs/v1/levi/3?op=CREATE&overwrite=false
Content-Length: 0
Server: Jetty(6.1.26)



OK, it failed.
Do somebody know what has happened?

RE: Put a file to Hadoop with WebHDFS ?

Posted by Brahma Reddy Battula <br...@huawei.com>.

you need to give the datanode http port,Like below


curl -i -X PUT -T /home/levi/3 "http://localhost:50075/webhdfs/v1/levi/3?op=CREATE<http://localhost:50070/webhdfs/v1/levi/3?op=CREATE>"


Syntax for writing file using webhdfs:

Create and Write to a File
• Step 1: Submit a HTTP PUT request without automatically following redirects and
without sending the file data
curl -i -X PUT "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=CREATE
[&overwrite=<true|false>][&blocksize=<LONG>][&replication=<SHORT>]
[&permission=<OCTAL>][&buffersize=<INT>]"

Step 2: Submit another HTTP PUT request using the URL in the Location header with
the file data to be written

curl -i -X PUT -T <LOCAL_FILE>
"http://<DATANODE>:<PORT>/webhdfs/v1/<PATH>?op=CREATE..."
________________________________
From: 小学园PHP [xxy-php@qq.com]
Sent: Wednesday, March 20, 2013 11:32 AM
To: user
Subject: Put a file to Hadoop with WebHDFS ?

When i use the WebHDFS, i wanna put a file to Hadoop.
my curl command:
curl -i -X PUT -T /home/levi/3 "http://localhost:50070/webhdfs/v1/levi/3?op=CREATE"

But i got a return:
HTTP/1.1 100 Continue

HTTP/1.1 307 TEMPORARY_REDIRECT
Content-Type: application/octet-stream
Location: http://58.53.211.46:50075/webhdfs/v1/levi/3?op=CREATE&overwrite=false
Content-Length: 0
Server: Jetty(6.1.26)

OK, it failed.
Do somebody know what has happened?

RE: Put a file to Hadoop with WebHDFS ?

Posted by Brahma Reddy Battula <br...@huawei.com>.

you need to give the datanode http port,Like below


curl -i -X PUT -T /home/levi/3 "http://localhost:50075/webhdfs/v1/levi/3?op=CREATE<http://localhost:50070/webhdfs/v1/levi/3?op=CREATE>"


Syntax for writing file using webhdfs:

Create and Write to a File
• Step 1: Submit a HTTP PUT request without automatically following redirects and
without sending the file data
curl -i -X PUT "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=CREATE
[&overwrite=<true|false>][&blocksize=<LONG>][&replication=<SHORT>]
[&permission=<OCTAL>][&buffersize=<INT>]"

Step 2: Submit another HTTP PUT request using the URL in the Location header with
the file data to be written

curl -i -X PUT -T <LOCAL_FILE>
"http://<DATANODE>:<PORT>/webhdfs/v1/<PATH>?op=CREATE..."
________________________________
From: 小学园PHP [xxy-php@qq.com]
Sent: Wednesday, March 20, 2013 11:32 AM
To: user
Subject: Put a file to Hadoop with WebHDFS ?

When i use the WebHDFS, i wanna put a file to Hadoop.
my curl command:
curl -i -X PUT -T /home/levi/3 "http://localhost:50070/webhdfs/v1/levi/3?op=CREATE"

But i got a return:
HTTP/1.1 100 Continue

HTTP/1.1 307 TEMPORARY_REDIRECT
Content-Type: application/octet-stream
Location: http://58.53.211.46:50075/webhdfs/v1/levi/3?op=CREATE&overwrite=false
Content-Length: 0
Server: Jetty(6.1.26)

OK, it failed.
Do somebody know what has happened?

RE: Put a file to Hadoop with WebHDFS ?

Posted by Brahma Reddy Battula <br...@huawei.com>.

you need to give the datanode http port,Like below


curl -i -X PUT -T /home/levi/3 "http://localhost:50075/webhdfs/v1/levi/3?op=CREATE<http://localhost:50070/webhdfs/v1/levi/3?op=CREATE>"


Syntax for writing file using webhdfs:

Create and Write to a File
• Step 1: Submit a HTTP PUT request without automatically following redirects and
without sending the file data
curl -i -X PUT "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=CREATE
[&overwrite=<true|false>][&blocksize=<LONG>][&replication=<SHORT>]
[&permission=<OCTAL>][&buffersize=<INT>]"

Step 2: Submit another HTTP PUT request using the URL in the Location header with
the file data to be written

curl -i -X PUT -T <LOCAL_FILE>
"http://<DATANODE>:<PORT>/webhdfs/v1/<PATH>?op=CREATE..."
________________________________
From: 小学园PHP [xxy-php@qq.com]
Sent: Wednesday, March 20, 2013 11:32 AM
To: user
Subject: Put a file to Hadoop with WebHDFS ?

When i use the WebHDFS, i wanna put a file to Hadoop.
my curl command:
curl -i -X PUT -T /home/levi/3 "http://localhost:50070/webhdfs/v1/levi/3?op=CREATE"

But i got a return:
HTTP/1.1 100 Continue

HTTP/1.1 307 TEMPORARY_REDIRECT
Content-Type: application/octet-stream
Location: http://58.53.211.46:50075/webhdfs/v1/levi/3?op=CREATE&overwrite=false
Content-Length: 0
Server: Jetty(6.1.26)

OK, it failed.
Do somebody know what has happened?

RE: Put a file to Hadoop with WebHDFS ?

Posted by Brahma Reddy Battula <br...@huawei.com>.

you need to give the datanode http port,Like below


curl -i -X PUT -T /home/levi/3 "http://localhost:50075/webhdfs/v1/levi/3?op=CREATE<http://localhost:50070/webhdfs/v1/levi/3?op=CREATE>"


Syntax for writing file using webhdfs:

Create and Write to a File
• Step 1: Submit a HTTP PUT request without automatically following redirects and
without sending the file data
curl -i -X PUT "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=CREATE
[&overwrite=<true|false>][&blocksize=<LONG>][&replication=<SHORT>]
[&permission=<OCTAL>][&buffersize=<INT>]"

Step 2: Submit another HTTP PUT request using the URL in the Location header with
the file data to be written

curl -i -X PUT -T <LOCAL_FILE>
"http://<DATANODE>:<PORT>/webhdfs/v1/<PATH>?op=CREATE..."
________________________________
From: 小学园PHP [xxy-php@qq.com]
Sent: Wednesday, March 20, 2013 11:32 AM
To: user
Subject: Put a file to Hadoop with WebHDFS ?

When i use the WebHDFS, i wanna put a file to Hadoop.
my curl command:
curl -i -X PUT -T /home/levi/3 "http://localhost:50070/webhdfs/v1/levi/3?op=CREATE"

But i got a return:
HTTP/1.1 100 Continue

HTTP/1.1 307 TEMPORARY_REDIRECT
Content-Type: application/octet-stream
Location: http://58.53.211.46:50075/webhdfs/v1/levi/3?op=CREATE&overwrite=false
Content-Length: 0
Server: Jetty(6.1.26)

OK, it failed.
Do somebody know what has happened?