Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

[SOLVED]Java Hdfs Program Fails With Connection Refused

avatar
Explorer

Hopefully someone can help me figure out what is going on.

I downloaded Hdp 2.6 for virtualbox and followed the instructions to install and set up. I am running it on Linux Mint 18. I am following along in the 'Hadoop the Definitive Guide' book and I am trying to run one of the examples. Here is the code I wrote from the book:

15476-idea.png

I set up my /etc/hosts like this, just following the instructions in the 'Learning the Ropes' tutorial.

15477-hosts.png

Following the book I do the following but I am getting a connection refused error. Is something not setup correctly?

15479-error.jpeg

Any and all help would be GREATLY appreciated. I was up super late last night trying to figure this out with no luck.

1 ACCEPTED SOLUTION

avatar
Cloudera Employee

dfs.namenode.datanode.registration.ip-hostname-check

If true (the default), then the namenode requires that a connecting datanode's address must be resolved to a hostname. If necessary, a reverse DNS lookup is performed. All attempts to register a datanode from an unresolvable address are rejected. It is recommended that this setting be left on to prevent accidental registration of datanodes listed by hostname in the excludes file during a DNS outage. Only set this to false in environments where there is no infrastructure to support reverse DNS lookup.

View solution in original post

4 REPLIES 4

avatar
Explorer

So the above works if I do:

hadoop com/thomp/io/FileSystemCat hdfs://sandbox.hortonworks.com:8020/HadoopPrac/Data/sample.txt

or if I do

hadoop com/thomp/io/FileSystemCat hdfs://172.17.0.2:8020/HadoopPrac/Data/sample.txt

Why is that? I set up hdp 2.6 sandbox on my mac and it works when I just do localhost. Why wouldn't it be the same thing since it is the same install?

Here is a screen shot of the /etc/hosts file on the vm:

15480-vmhosts.png

avatar
Cloudera Employee

You can execute the following tests bellow, usually the sanbox hdfs is not set to listen to localhost, but to sandbox.hortonworks.com;

hdfs$ hdfs dfs -ls hdfs://sandbox.hortonworks.com/tmp

You can try with localhost and should fail with the same Error:

hdfs$ hdfs dfs -ls hdfs://localhost/tmp

To check, just go to ambari:services:hdfs:configs:Advance and filter for port number 8020;

avatar
Cloudera Employee

dfs.namenode.datanode.registration.ip-hostname-check

If true (the default), then the namenode requires that a connecting datanode's address must be resolved to a hostname. If necessary, a reverse DNS lookup is performed. All attempts to register a datanode from an unresolvable address are rejected. It is recommended that this setting be left on to prevent accidental registration of datanodes listed by hostname in the excludes file during a DNS outage. Only set this to false in environments where there is no infrastructure to support reverse DNS lookup.

avatar
Explorer

Okay, that makes sense.

And I just checked and on my mac I was actually doing the command:

hadoop com/thomp/io/FileSystemCat /HadoopPrac/Data/sample.txt

which also worked.

Thanks again!