HTTP request to webhdfs but empty response from server

I am new to hadoop. I have included webhdfs and use the curl command to get the Home directory.

curl -i "http://172.16.18.50:9000/webhdfs/v1/?op=GETHOMEDIRECTORY"

But get the information: an empty response from the server. Here are the conf files:

core-site.xml ----

<configuration> <property> <name>fs.default.name</name> <value>hdfs://webHDFS0:9000</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/home/eins/hadoop-1.0.2/tmp</value> </property> </configuration> 

hdfs-site.xml ----

 <configuration> <property> <name>dfs.replication</name> <value>2</value> </property> <property> <name>dfs.webhdfs.enabled</name> <value>enabled</value> </property> </configuration> 

Can anyone give any suggestions?

+6
source share
1 answer

You are trying to connect to the NameNode IPC socket (port 9000) and not to the web socket (which is 50075 by default). Try instead:

 http://172.16.18.50:50075/webhdfs/v1/?op=GETHOMEDIRECTORY 

In addition, your configuration in hdfs-site.xml should be true and not enabled as its value:

hdfs-site.xml ----

 <configuration> <property> <name>dfs.replication</name> <value>2</value> </property> <property> <name>dfs.webhdfs.enabled</name> <value>true</value> </property> </configuration> 

To make sure everything works, look at the logs for your namenode, you should see something like:

 2012-05-22 06:23:42,176 INFO org.apache.hadoop.http.HttpServer: dfs.webhdfs.enabled = true 2012-05-22 06:23:42,177 INFO org.apache.hadoop.http.HttpServer: Added filter 'SPNEGO' (class=org.apache.hadoop.hdfs.web.AuthFilter) 2012-05-22 06:23:42,179 INFO org.apache.hadoop.http.HttpServer: addJerseyResourcePackage: packageName=org.apache.hadoop.hdfs.server.namenode.web.resources;org.apache.hadoop.hdfs.web.resources, pathSpec=/webhdfs/v1/* 

At the moment, I assume yours says:

 2012-05-22 06:11:20,676 INFO org.apache.hadoop.http.HttpServer: dfs.webhdfs.enabled = false 
+16
source

Source: https://habr.com/ru/post/916190/


All Articles