So telnet actually is working, I mean telnet localhost 25 is connecting; but telnet localhost or telnet localhost 9000 got such result:

telnet: Unable to connect to remote host: Connection refused

nmap results:

$ nmap localhost

Starting Nmap 6.00 ( http://nmap.org ) at 2013-10-03 00:54 MSK
Nmap scan report for localhost (
Host is up (0.00030s latency).
rDNS record for localhost.localdomain
Not shown: 992 closed ports
22/tcp   open  ssh
25/tcp   open  smtp
80/tcp   open  http
587/tcp  open  submission
631/tcp  open  ipp
3306/tcp open  mysql
5432/tcp open  postgresql
6566/tcp open  sane-port

nmap on 9000 port:

$ nmap -p 9000 localhost

Starting Nmap 6.00 ( http://nmap.org ) at 2013-10-03 00:55 MSK
Nmap scan report for localhost (
Host is up (0.000040s latency).
rDNS record for localhost.localdomain
9000/tcp closed cslistener

So the question is how to open necessary port, Im using Ubuntu 13.04; tried to disable ufw, tried to play with iptables; nothing helped. Dunno even what to do...

I need 9000 port for hadoop; I cant access fs without opened 9000 port

  • 1
    You don't have a telnet problem. As your output shows you can connect to port 25 because it is open; you cannot connect to port 23 (the default telnet port) because it is not listening; you cannot connect to port 9000 because it is closed. Your telnet is working perfectly. Your problem is that port 9000 is closed. Please modify your question accordingly. – zwets Oct 2 '13 at 21:32
  • ok; I changed my question, thx – DaunnC Oct 3 '13 at 4:16
  • Your question still seems to be missing the necessary context. Please modify it so that it clarifies the following: why do you think you need port 9000? do you get an error message saying the port cannot be opened (please show the error message)? what software requires it but cannot connect to it? what software do you think should be listening on it? – zwets Oct 3 '13 at 5:29
  • Man, thx, but I all wrote, I knew that smb gonna ask me about why I need this port or any port; so i repeat especially for u: 'I need 9000 port for hadoop'. – DaunnC Oct 3 '13 at 6:08
  • 1
    @DaunnC , could you please provide some explanation on how did you solve your problem? I am stucked in the same connection refused error (compare my post), appearing on the very first step - the standalone operation step. I followed this tutorial. I would be very grateful for any help. – Marta Karas Apr 26 '15 at 20:42

The reason for connection refused is simple - the port 9000 is NOT being used (not open).

Use the command => lsof -i :9000 to see what app is using the port. If the result is empty (return value 1) then it is not open.

You can even test further with netcat.

List on port 9000 in terminal session 1

nc -l -p 9000

In another session, connect to it

$ lsof -i :9000
nc      12679 terry    3u  IPv4 7518676      0t0  TCP *:9000 (LISTEN)
$ nc -vz localhost 9000
Connection to localhost 9000 port [tcp/*] succeeded!

So you need to fix your hadoop settings and make sure all necessary daemons/services are started properly before you can connect to use HDFS.

NOTE: This is NOT telnet nor iptables issue, it's basically TCP/IP basics. Please change the question to sth like "connecting to port 9000 issue".


i need 9000 port for hadoop; I can't access fs without opened 9000 port so base on the context my understanding is that HDFS's namenode is supposed to use port 9000. So check your Hadoop/HDFS configuration files and get the services started.

iptables is irrelevant at this stage because the port is NOT used at all.

You can run iptables -L -vn to make sure there is no rules in effected. You can flush the filter table INPUT chain to make sure sudo iptables -P INPUT ACCEPT && sudo iptables -F -t filter

| improve this answer | |
  • thx; but i have no apps on 9000 port; so the question is how to open necessary port. I've tried to disable iptables and ufw... btw, I can connect to port 11211 (memcached); and to opened ports form nmap localhost – DaunnC Oct 3 '13 at 4:41
  • You mentioned i need 9000 port for hadoop; I can't access fs without opened 9000 port, so in you context I think hadoop/HDFS services are supposed to use the port and your client applications need to connect to the port. To sum up, you need to configure hadoop properly and start it so it'll use the port. – Terry Wang Oct 3 '13 at 6:05
  • ok; thx; i did so; it helped! – DaunnC Oct 3 '13 at 8:10
  • See the update in the answer also. The problem is your HDFS configuration NOT Linux networking. – Terry Wang Oct 3 '13 at 12:04
  • @DaunnC Provide some more details on how the issue is fixed. I'll update the answer so that you can tick it as answered. – Terry Wang Oct 4 '13 at 3:18

If it helps anyone, I solved my similar problem by formatting the namenode again:

hdfs namenode -format
| improve this answer | |
  • Solved the problem for me, but be warned this does wipe the existing hdfs folder structure that you had in place. – Mark Nielsen Jan 24 '18 at 19:52

I had this same problem. At first, it worked fine with 'hdfs namenode -format', although just for one time. It happened that I used '/usr/hadoop-2.9.0/sbin/start-dfs.sh' (and stop-dfs.sh) to start Hadoop. Just when I began to use '/usr/hadoop-2.9.0/sbin/start-all.sh' (after had applied 'hdfs namenode -format') the 9000 port began to be used by Hadoop. "Stranger things!"

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.