Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

http request to webhdfs, but empty reply from server

Tags:

hadoop

I'm new in hadoop. I enabled the webhdfs and use the curl command to get a Home Directory.

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

But get the information : Empty reply from server.Here is 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 some suggestions?

like image 903
xmuwc Avatar asked May 20 '12 10:05

xmuwc


1 Answers

You're trying to connect to the NameNode IPC socket (port 9000), rather than the web socket (which defaults to 50075). Try this instead:

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

Also, your configuration in hdfs-site.xml needs to have true rather than 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 confirm everything is working, 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
like image 104
Chris White Avatar answered Nov 16 '22 02:11

Chris White