5

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

Trying 127.0.0.1... 
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 (127.0.0.1)
Host is up (0.00030s latency).
rDNS record for 127.0.0.1: localhost.localdomain
Not shown: 992 closed ports
PORT     STATE SERVICE
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 (127.0.0.1)
Host is up (0.000040s latency).
rDNS record for 127.0.0.1: localhost.localdomain
PORT     STATE  SERVICE
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

Braiam
  • 67,791
  • 32
  • 179
  • 269
DaunnC
  • 153
  • 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 02 '13 at 21:32
  • ok; I changed my question, thx – DaunnC Oct 03 '13 at 04: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 03 '13 at 05: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 03 '13 at 06: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
  • @Marciszka in my case, it happened so, that i got overlapping ip ports with some apps on my host machine. How I found it (note: it kills all processes on port 9000 in this example): sudo kill $(sudo lsof -t -i:9000) afterwards everything was ok. So check the availability of this port. – DaunnC Apr 27 '15 at 10:50

3 Answers3

5

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
COMMAND   PID  USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
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".

Update

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

Terry Wang
  • 9,775
  • 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 03 '13 at 04: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 03 '13 at 06:05
  • ok; thx; i did so; it helped! – DaunnC Oct 03 '13 at 08:10
  • See the update in the answer also. The problem is your HDFS configuration NOT Linux networking. – Terry Wang Oct 03 '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 04 '13 at 03:18
1

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

hdfs namenode -format
Louis M
  • 151
0

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!"