问题
curl -i -X PUT "http://SomeHostname:50070/webhdfs/v1/file1?op=CREATE"
HTTP/1.1 307 TEMPORARY_REDIRECT
Content-Type: application/octet-stream
Location: http://sslave0:50075/webhdfs/v1/file1?op=CREATE&overwrite=false
Content-Length: 0
Server: Jetty(6.1.26)
here it return sslave0 for datanode, seem like an internal address to me
回答1:
With WebHDFS, the NameNode web interface @port 50070 in your case accepts the put request and assigns the metadata information about the file to be stored. It then returns a redirect to a Data Node address (the ssalve0:50075 address) where the actual Http PUT is completed.
Bottom line - the Name Node doesn't store any real data, only metadata. It's the Data Nodes which store the actual information for a file - hence the redirect
If you want to have a single proxy node by which you don't have to deal with the data nodes in this way, then you want to configure HttpFs instead.
来源:https://stackoverflow.com/questions/19936313/webhdfs-returns-wrong-datanode-address