title: Host and port to use to list a directory in hdfs
body: <p>First of all, I'm using HortonWorks Sandbox as Hadoop dist, with no custom configuration at all.</p>
  
  <p>Once connected on the sandbox, I'm able to list files of a HDFS directory doing :</p>
  
  <p><code>[root@sandbox ~]# hadoop fs -ls hdfs:///user/guest</code></p>
  
  <p>but if I try to specify a host and port I get only errors :</p>
  
  <p><code>[root@sandbox ~]# hadoop fs -ls hdfs://localhost:8020/user/guest
  ls: Call From sandbox.hortonworks.com/10.0.2.15 to localhost:8020 failed on connection exception: java.net.ConnectException: Connexion refusée; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused</code></p>
  
  <p><code>[root@sandbox ~]# hadoop fs -ls hdfs://localhost:9000/user/guest
  ls: Call From sandbox.hortonworks.com/10.0.2.15 to localhost:9000 failed on connection exception: java.net.ConnectException: Connexion refusée; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused</code></p>
  
  <p>Once I know the correct host and port to use, I'll be able to use them in my Java call :</p>
  
  <p><code>Path pt = new Path("hdfs://host:port/user/guest/test-text-file.txt");</code></p>