Trying to get Hadoop to work; "connection refused" in Hadoop and in Telnet 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 &lt;username&gt;.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 &lt;username&gt;.local/&lt;ip&gt; 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 &lt;port&gt; to see if the port is open there.
  On the client, try a telnet &lt;server&gt; &lt;port&gt; 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.
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.