0

I was trying to get Hadoop working in standalone mode on my MBP (OS 10.9.5), but I kept getting "connection refused" errors. I found that telnet localhost 9000 gives the same error, which is what I was told to try as a diagnostic. The same thing happens if I try 127.0.0.1 instead of localhost, or if I try ftp instead of telnet. However ping localhost and ssh localhost work fine.

I had messed around a while ago with setting up an Apache server, and I'm concerned I might have broken something. At some point, I had apparently added the line:

127.0.0.1    test.local

to /etc/hosts. I also had modified httpd.conf to use the folder ~/test as my DocumentRoot, and had changed to extra/httpd-vhosts.conf as well.

I restored the original httpd* files from the /etc/apache2/original folder, and I restored the /etc/hosts file to its original state. apachectl configtest gives me:

httpd: Could not reliably determine the server's fully qualified domain name, using <username>.local for ServerName
Syntax OK

So what do I do? How can I get my computer to stop refusing the connection? I don't know much about networking or servers.


For completeness, here's the original telnet error:

$ ssh localhost
$ telnet localhost 9000
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Trying fe80::1...
telnet: connect to address fe80::1: Connection refused
telnet: Unable to connect to remote host

and my /etc/hosts file:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0 localhost

and the Hadoop error which uses the same "connection refused" language as telnet:

java.net.ConnectException: Call From <username>.local/<ip> to localhost:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused

Following the link in the error (http://wiki.apache.org/hadoop/ConnectionRefused), I read the following:

If the application or cluster is not working, and this message appears in the log, then it is more serious.

  • Check the hostname the client using is correct
  • Check the IP address the client is trying to talk to for the hostname is correct.
  • Make sure the destination address in the exception isn't 0.0.0.0 -this means that you haven't actually configured the client with the real address for that service, and instead it is picking up the server-side property telling it to listen on every port for connections.
  • Check that there isn't an entry for your hostname mapped to 127.0.0.1 or 127.0.1.1 in /etc/hosts (Ubuntu is notorious for this)
  • Check the port the client is trying to talk to using matches that the server is offering a service on.
  • On the server, try a telnet localhost <port> to see if the port is open there.
  • On the client, try a telnet <server> <port> to see if the port is accessible remotely.

None of these are Hadoop problems, they are host, network and firewall configuration issues. As it is your cluster, only you can find out and track down the problem.

and indeed I fail on the second-to-last step, which apparently should work; hence this question.

1
  • Would this question be better suited for StackOverflow? I still haven't figured this out. Commented Oct 30, 2014 at 20:05

4 Answers 4

0

It's normal getting conection refused if you ftp or telnet to localhost, at least if you haven't up and running that kind of servers, and by default, you don't.

The /etc/hosts should look like 127.0.0.1 localhost by default. To use apache and avoid the error you mentioned, you must add ServerName localhost to httpd.conf. Restart apache and should works fine.

Don't know if this solve Hadoop error too. Can't help you on it. Just try and let me know.

1
0

It turns out I had "Remote Login" disabled in System Preferences!

The solution was:

System Preferences -> Sharing -> Check the "Remote Login" box

Although I also reformatted by hard drive and upgraded to Yosemite, so having a fresh version of Apache probably helped too.

0

Sometimes this exception is thrown when one starts hadoop without starting the namenode, so before you run sbin/start-dfs.sh it is advisable to run:

bin/hdfs namenode

Good luck.

0

I am also getting same error while running hadoop dfs -ls

<HOSTNAME> to 0.0.0.0:9000 failed on connection
exception: java.net.ConnectException: Connection refused; 
For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused

For me it was problem with permission issue; run hadoop namenode -format and check if you are getting below exception:

java.io.IOException: Cannot create directory /usr/local/hadoop/dfs/name/current
java.io.IOException: Cannot create directory /usr/local/hadoop/dfs/name/current

If you are getting above exception; give write permission ;

  • Stop hadoop
  • sudo chmod 777 /usr/local/hadoop/dfs/name/
  • Start hadoop
  • hadoop namenode -format to verify
1
  • chmod 777 might be a bit extreme here, did you try 775?
    – nohillside
    Commented Oct 13, 2018 at 9:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .