hadoop web 接口上传文件

来源:互联网 发布:nokia5310软件下载 编辑:程序博客网 时间:2024/06/07 06:54

1. 使用HTTP  PUT

hadoop web 接口传文件abcd.exe

hadoop 部署在118,

PUT /webhdfs/v1/abcd.exe?op=CREATE&overwrite=true HTTP/1.1\r\n

Host: 192.168.1.118:50070\r\n

Accept: */*\r\n

Content-Length: 0\r\n

Content-Type: application/x-www-form-urlencoded\r\n

Connection: close\r\n

返回307 提取跳转地址, 打开文件取得文件大小len = 100000

PUT /webhdfs/v1/abcd.exe?op=CREATE&namenoderpcaddress=192.168.1.118:50040&overwrite=true HTTP/1.1\r\n

Host: 192.168.1.118:50075\r\n

Accept: */*\r\n

Content-Length: 100000\r\n

Expect: 100-Continue\r\n\r\n

返回100 continue,读取文件发送,注意使用的是上面跳转地址的的socket发送

发送.....

发送完毕返回201

关闭连接。

0 0
原创粉丝点击