title: Accessing hadoop from remote machine
body: <p>I have hadoop set up (pseudo distributed) on a server VM and I'm trying
  to use the Java API to access the HDFS. </p>
  
  <p>The fs.default.name on my server is <code>hdfs://0.0.0.0:9000</code> (as with <code>localhost:9000</code> it wouldn't accept requests from remote sites). </p>
  
  <p>I can connect to the server on port 9000 </p>
  
  <pre><code>$ telnet srv-lab 9000
  Trying 1*0.*.30.95...
  Connected to srv-lab
  Escape character is '^]'.
  ^C
  </code></pre>
  
  <p>which indicates to me that connection should work fine. The Java code I'm using is:</p>
  
  <pre><code>try {
          Path pt = new Path(
                  "hdfs://srv-lab:9000/test.txt");
          Configuration conf = new Configuration();
          conf.set("fs.default.name", "hdfs://srv-lab:9000");
          FileSystem fs = FileSystem.get(conf);
          BufferedReader br = new BufferedReader(new InputStreamReader(
                  fs.open(pt)));
          String line;
          line = br.readLine();
          while (line != null) {
              System.out.println(line);
              line = br.readLine();
          }
      } catch (Exception e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p>but what I get is:</p>
  
  <pre><code>java.net.ConnectException: Call From clt-lab/1*0.*.2*2.205 to srv-lab:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused
  </code></pre>
  
  <p>Thus, any hints on why the connection is refused even though connecting through telnet works fine?</p>