I successfully installed and run Hadoop on a single machine whose ip is 192.168.1.109 (In fact it is actually an Ubuntu instance running on virtual box ) . When typing jps it shows
2473 DataNode
2765 TaskTracker
3373 Jps
2361 NameNode
2588 SecondaryNameNode
2655 JobTracker
This should mean that the hadoop is up and running. Running commands like ./hadoop fs -ls is fine and produces the expected result.
But If I try to connect it from my windows box whose ip is 192.168.1.80 by writing Java code's HDFS API to connect it as follows:
Configuration conf = new Configuration();
FileSystem hdfs = null;
Path filenamePath = new Path(FILE_NAME);
hdfs = FileSystem.get(conf); <-- the problem occurred at this line
when I run the code, the error displayed as follows:
11/12/07 20:37:24 INFO ipc.Client: Retrying connect to server: /192.168.1.109:9000. Already tried 0 time(s).
11/12/07 20:37:26 INFO ipc.Client: Retrying connect to server: /192.168.1.109:9000. Already tried 1 time(s).
11/12/07 20:37:28 INFO ipc.Client: Retrying connect to server: /192.168.1.109:9000. Already tried 2 time(s).
11/12/07 20:37:30 INFO ipc.Client: Retrying connect to server: /192.168.1.109:9000. Already tried 3 time(s).
11/12/07 20:37:32 INFO ipc.Client: Retrying connect to server: /192.168.1.109:9000. Already tried 4 time(s).
11/12/07 20:37:33 INFO ipc.Client: Retrying connect to server: /192.168.1.109:9000. Already tried 5 time(s).
11/12/07 20:37:35 INFO ipc.Client: Retrying connect to server: /192.168.1.109:9000. Already tried 6 time(s).
11/12/07 20:37:37 INFO ipc.Client: Retrying connect to server: /192.168.1.109:9000. Already tried 7 time(s).
11/12/07 20:37:39 INFO ipc.Client: Retrying connect to server: /192.168.1.109:9000. Already tried 8 time(s).
11/12/07 20:37:41 INFO ipc.Client: Retrying connect to server: /192.168.1.109:9000. Already tried 9 time(s).
java.net.ConnectException: Call to /192.168.1.109:9000 failed on connection exception: java.net.ConnectException: Connection refused: no further information
To make sure if the socket is already opened and waits for the incoming connections on the hadoop serer, I netstat on the ubuntu box the result shows as follows:
tcp 0 0 localhost:51201 : LISTEN 2765/java
tcp 0 0 *:50020 : LISTEN 2473/java
tcp 0 0 localhost:9000 : LISTEN 2361/java
tcp 0 0 localhost:9001 : LISTEN 2655/java
tcp 0 0 *:mysql : LISTEN -
tcp 0 0 *:50090 : LISTEN 2588/java
tcp 0 0 *:11211 : LISTEN -
tcp 0 0 *:40843 : LISTEN 2473/java
tcp 0 0 *:58699 : LISTEN -
tcp 0 0 *:50060 : LISTEN 2765/java
tcp 0 0 *:50030 : LISTEN 2655/java
tcp 0 0 *:53966 : LISTEN 2655/java
tcp 0 0 *:www : LISTEN -
tcp 0 0 *:epmd : LISTEN -
tcp 0 0 *:55826 : LISTEN 2588/java
tcp 0 0 *:ftp : LISTEN -
tcp 0 0 *:50070 : LISTEN 2361/java
tcp 0 0 *:52822 : LISTEN 2361/java
tcp 0 0 *:ssh : LISTEN -
tcp 0 0 *:55672 : LISTEN -
tcp 0 0 *:50010 : LISTEN 2473/java
tcp 0 0 *:50075 : LISTEN 2473/java
I noticed that if the local address column is something like localhost:9000 (starts with localhost: not *:) It will not be able to be connected from remote host or even in it own box in some case. I tried telnet localhost 9000 it works, I means it can connect to the port but If I use telnet 192.168.1.109 9000 The errors displays like
$ telnet 192.168.1.109 9000 Trying 192.168.1.109... telnet: Unable to connect to remote host: Connection refused
I have spent almost a week figuring out the issue I am really exhausted now and I hope someone can help me.
Note: I am not sure if namenode by default refuses remote connection. Do I need to change some settings in order for it to allow remote connections?