I can't connect to Hadoop port 9000
Solution 1:
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
Solution 2:
If it helps anyone, I solved my similar problem by formatting the namenode again:
hdfs namenode -format