Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hadoop - Connection refused on namenode

I've searched web and stackoverflow for a long time but it was not useful.

I have installed hadoop yarn 2.2.0 in 2 node cluster setup. but something goes wrong. when I start hadoop daemons using start-dfs.sh and start-yarn.sh on master node, they successfully run in master and slave (my master's hostname is RM and my slave's hostname is slv). they can ssh each other successfully. but when I want to run a job, this error appears:

14/01/02 04:22:53 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 14/01/02 04:22:56 WARN hdfs.DFSClient: DataStreamer Exception org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /user/root/QuasiMonteCarlo_1388665371850_813553673/in/part0 could only be replicated to 0 nodes instead of minReplication (=1). There are 0 datanode(s) running and no node(s) are excluded in this operation. at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget(BlockManager.java:1384) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:2477) at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:555) at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:387) at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java:59582) at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585) at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:928) at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2048) at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2044) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:416) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491) at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2042)

at org.apache.hadoop.ipc.Client.call(Client.java:1347)
at org.apache.hadoop.ipc.Client.call(Client.java:1300)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:206)
at com.sun.proxy.$Proxy9.addBlock(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:186)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
at com.sun.proxy.$Proxy9.addBlock(Unknown Source)
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.addBlock(ClientNamenodeProtocolTranslatorPB.java:330)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.locateFollowingBlock(DFSOutputStream.java:1226)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:1078)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:514)

and in datanode log this log exists:

2014-01-02 04:40:31,616 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Problem connecting to server: RM/192.168.1.101:9000 2014-01-02 04:40:37,618 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: RM/192.168.1.101:9000. Already tried 0 time(s)$ 2014-01-02 04:40:38,619 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: RM/192.168.1.101:9000. Already tried 1 time(s)$ 2014-01-02 04:40:39,620 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: RM/192.168.1.101:9000. Already tried 2 time(s)$ 2014-01-02 04:40:40,621 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: RM/192.168.1.101:9000. Already tried 3 time(s)

I checked the 9000 port on the master node and the output is this:

tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 10227/java

I guess the problem is caused by the reason that in the slave node when I

telnet RM 9000

it says

Trying 192.168.1.101... telnet: Unable to connect to remote host: Connection refused

however

telnet RM

the output is :

Trying 192.168.1.101... Connected to RM. Escape character is '^]'. Ubuntu 12.04.2 LTS RM login:

for additional information my /etc/hosts on master and slave is as below:

127.0.0.1 RM|slv localhost

192.168.1.101 RM

192.168.1.103 slv

can anybody suggest me a solution? any help is really appreciated. thanks

like image 512
masoumeh Avatar asked Jan 02 '14 12:01

masoumeh


People also ask

How to fix connection refused error in Hadoop cluster?

Here is we provided a simple solution for Connection refused error in the Hadoop cluster. In a single-node Hadoop cluster without data, then follow the below steps. Step 2: If you have no data then format the namenode using below one: Step 3: Start all services like name node, data node, yarn, and etc.

What is Hadoop NameNode?

What is Namenode? In the Hadoop eco-system, Namenode is a major role in metadata storage that’s why it is called a master node in a Hadoop cluster. It maintains all data nodes (slave nodes).

What are the common errors in Hadoop?

[Solved] Hadoop3 Install Error: there is no HDFS_NAMENODE_USER defined. Aborting operation. Error: there is no HDFS_NAMENODE_USER defined. Aborting operation. Hadoop Connect hdfs Error: could only be replicated to 0 nodes instead of minReplication (=1). [Hadoop 2.

Why can't I connect to HDFS with Hadoop?

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


2 Answers

I think the problem is that your master is listening on 127.0.0.1:9000, so datanode can't connect because it is not listening at 192.168.1.101:9000 (theoretically, a good place to listen is 0.0.0.0:9000 since avoids this problems, but seems this configuration is not accepted).

Maybe will fix modifying your /etc/hosts deleting the first line, or try first just with:

127.0.0.1 localhost
192.168.1.101 RM
192.168.1.103 slv

-- edit: read comments bellow

like image 84
Alfonso Nishikawa Avatar answered Oct 21 '22 02:10

Alfonso Nishikawa


I had the same problem, I changed

<property>
    <name>fs.defaultFS</name>
    <value>hdfs://localhost:8020</value>
</property>

in core-site.xml to

<property>
    <name>fs.defaultFS</name>
    <value>hdfs://ip-address:8020</value>
</property>

and it worked

like image 20
gary69 Avatar answered Oct 21 '22 02:10

gary69