webhdfs always redirect to localhost:50075

2019-09-05 13:24发布

I have a hdfs cluster (hadoop 2.7.1), with one namenode, one secondary namenode, 3 datanodes.

When I enable webhdfs and test, I found it always redirect to "localhost:50075" which is not configured as datanodes.

csrd@secondarynamenode:~/lybica-hdfs-viewer$ curl -i -L "http://10.56.219.30:50070/webhdfs/v1/demo.zip?op=OPEN"
HTTP/1.1 307 TEMPORARY_REDIRECT
Cache-Control: no-cache
Expires: Tue, 01 Dec 2015 03:29:21 GMT
Date: Tue, 01 Dec 2015 03:29:21 GMT
Pragma: no-cache
Expires: Tue, 01 Dec 2015 03:29:21 GMT
Date: Tue, 01 Dec 2015 03:29:21 GMT
Pragma: no-cache
Location: http://localhost:50075/webhdfs/v1/demo.zip?op=OPEN&namenoderpcaddress=10.56.219.30:9000&offset=0
Content-Type: application/octet-stream
Content-Length: 0
Server: Jetty(6.1.26)

curl: (7) Failed to connect to localhost port 50075: Connection refused

The etc/hadoop/slaves is configured as:

10.56.219.32
10.56.219.33
10.56.219.34

Is there any configurations on this?

Thanks!

2条回答
beautiful°
2楼-- · 2019-09-05 13:51

You need to have this entry in hdfs-site.xml

<property>
  <name>dfs.datanode.http.address</name>
  <value>0.0.0.0:50075</value>
</property>

Value should be 0.0.0.0 on a cluster. You need to restart the cluster after updating hdfs-site.xml file and deploying it on all nodes in the cluster.

查看更多
时光不老,我们不散
3楼-- · 2019-09-05 13:52

Well, it's a /etc/hosts mistake.

The /etc/hosts on datanodes was:

127.0.0.1   localhost datanode-1

change it to:

127.0.0.1   datanode-1 localhost

fix this problem.

查看更多
登录 后发表回答