First of all, I use HortonWorks Sandbox as a Hadoop dist, without any custom configuration.
After connecting to the sandbox, I can view the HDFS directory files:
[root@sandbox ~]# hadoop fs -ls hdfs:///user/guest
but if I try to specify the host and port, I get only errors:
[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
[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
Once I know the correct host and port to use, I can use them in my Java call:
Path pt = new Path("hdfs://host:port/user/guest/test-text-file.txt");
source
share