【原创】hadoop启动错误 找不到路由 解决方法


hadoop启动过程中遇到下面的问题:


2012-07-04 18:43:20,763 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: STARTUP_MSG: /************************************************************ STARTUP_MSG: Starting DataNode STARTUP_MSG: host = slave1/192.168.18.87 STARTUP_MSG: args = [] STARTUP_MSG: version = 0.20.2 STARTUP_MSG: build = https://svn.apache.org/repos/asf ... ranches/branch-0.20 -r 911707; compiled by 'chrisdo' on Fri Feb 19 08:07:34 UTC 2010 ************************************************************/ 2012-07-04 18:43:22,468 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: /192.168.18.218:9000. Already tried 0 time(s). 2012-07-04 18:43:23,468 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: /192.168.18.218:9000. Already tried 1 time(s). 2012-07-04 18:43:24,469 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: /192.168.18.218:9000. Already tried 2 time(s). 2012-07-04 18:43:25,470 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: /192.168.18.218:9000. Already tried 3 time(s). 2012-07-04 18:43:26,471 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: /192.168.18.218:9000. Already tried 4 time(s). 2012-07-04 18:43:27,472 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: /192.168.18.218:9000. Already tried 5 time(s). 2012-07-04 18:43:28,473 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: /192.168.18.218:9000. Already tried 6 time(s). 2012-07-04 18:43:29,474 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: /192.168.18.218:9000. Already tried 7 time(s). 2012-07-04 18:43:30,475 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: /192.168.18.218:9000. Already tried 8 time(s). 2012-07-04 18:43:31,475 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: /192.168.18.218:9000. Already tried 9 time(s). 2012-07-04 18:43:31,479 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Call to /192.168.18.218:9000 failed on local exception: java.net.NoRouteToHostException: 没有到主机的路由 at org.apache.hadoop.ipc.Client.wrapException(Client.java:775) at org.apache.hadoop.ipc.Client.call(Client.java:743) at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:220) at $Proxy4.getProtocolVersion(Unknown Source) at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:359) at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:346) at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:383) at org.apache.hadoop.ipc.RPC.waitForProxy(RPC.java:314) at org.apache.hadoop.ipc.RPC.waitForProxy(RPC.java:291) at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:269) at org.apache.hadoop.hdfs.server.datanode.DataNode.(DataNode.java:216) at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:1283) at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1238) at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:1246) at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:1368) Caused by: java.net.NoRouteToHostException: 没有到主机的路由 at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:701)

NameNode启动start-all.sh时出现上述错误,解决办法如下:

(1)从namenode主机ping其它主机名(如:ping slave1),如果ping不通,原因可能是namenode节点的/etc/hosts配置错误

(2)从datanode主机ping namenode主机名,如果ping不通,原因可能是datenode节点的/etc/hosts配置的配置错误

解决办法:以上两种错误都需要修改/etc/hosts,同时保证集群中所有机器的/etc/hosts一致,参考:http://hi.baidu.com/tdfrank/blog/item/a1b9e1d95e3b013f10df9b01.html

(3)查看namenode主机的9000(具体根据core-site.xml中的fs.default.name节点配置)端口,是否打开,如果已打开(如下图所示),原因可能是防火墙开启,解决办法:关闭namenode和datanode主机的防火墙,或者设置防火墙开启指定端口

[root@master swxing]# netstat -nap | grep 9000
tcp        0      0 ::ffff:192.168.18.218:9000  :::*                        LISTEN      4662/java           
tcp        0      0 ::ffff:192.168.18.218:46116 ::ffff:192.168.18.218:9000  ESTABLISHED 4859/java           
tcp        0      0 ::ffff:192.168.18.218:9000  ::ffff:192.168.18.87:36794  ESTABLISHED 4662/java           
tcp        0      0 ::ffff:192.168.18.218:9000  ::ffff:192.168.18.218:46116 ESTABLISHED 4662/java      

 

[root@master swxing]# service iptables stop

可以参考:http://www.cnblogs.com/siwei1988/archive/2012/07/12/2587527.html  设置开机不启动防火墙服务,这样就不用每次开机后都设置了。

(4)格式化硬盘(hadoop namenode -format)后启动namenode(start-all.sh)

 

以上操作命令是在centos6.1中的操作命令,其它linux系统的操作命令可能有些不一样,读者根据自己的系统来定义操作,本文只提供一个思路。

转载于:https://www.cnblogs.com/siwei1988/archive/2012/07/04/2576070.html

你可能感兴趣的:(【原创】hadoop启动错误 找不到路由 解决方法)