標籤:沒有到主機的路由 hadoop
hadoop啟動過程中遇到下面的問題:
2015-08-02 19:43:20,771 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting DataNode
STARTUP_MSG: host = slave1/192.168.198.21
STARTUP_MSG: args = []
STARTUP_MSG: version = 1.2.1
STARTUP_MSG: build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.2 -r 1503152; compiled by ‘mattf‘ on Mon Jul 22 15:23:09 PDT 2013
STARTUP_MSG: java = 1.7.0_79
************************************************************/
2015-08-02 19:43:20,902 INFO org.apache.hadoop.metrics2.impl.MetricsConfig: loaded properties from hadoop-metrics2.properties
2015-08-02 19:43:20,910 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source MetricsSystem,sub=Stats registered.
2015-08-02 19:43:20,911 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Scheduled snapshot period at 10 second(s).
2015-08-02 19:43:20,911 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: DataNode metrics system started
2015-08-02 19:43:21,033 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source ugi registered.
2015-08-02 19:43:21,036 WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Source name ugi already exists!
2015-08-02 19:43:30,237 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: master/192.168.198.20:9000. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
2015-08-02 19:43:31,239 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: master/192.168.198.20:9000. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
2015-08-02 19:43:31,247 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Call to master/192.168.198.20:9000 failed on local exception: java.net.NoRouteToHostException: 沒有到主機的路由
at org.apache.hadoop.ipc.Client.wrapException(Client.java:1150)
at org.apache.hadoop.ipc.Client.call(Client.java:1118)
at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:229)
at com.sun.proxy.$Proxy3.getProtocolVersion(Unknown Source)
at org.apache.hadoop.ipc.RPC.checkVersion(RPC.java:422)
at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:414)
at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:392)
at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:374)
at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:453)
at org.apache.hadoop.ipc.RPC.waitForProxy(RPC.java:335)
at org.apache.hadoop.ipc.RPC.waitForProxy(RPC.java:300)
at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:385)
at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:321)
at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:1712)
at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1651)
at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:1669)
at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:1795)
at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:1812)
Caused by: java.net.NoRouteToHostException: 沒有到主機的路由
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
分析:
這種沒有到主機的路由問題屢見不鮮了,一般要麼是namenode 與 datanode 主機名稱間本身互ping就ping不通,這個機率較小,因為都知道要保證master與slaves 節點是能正常通訊,所以都會檢查。那麼最有可能就是防火牆沒有關閉,或者因為查看不出防火牆狀態,所以誤以為防火牆關閉了。
解決方案:
(1)從namenode主機ping其它slaves節點的主機名稱(注意是slaves節點的主機名稱),如果ping不通,原因可能是namenode節點的/etc/hosts 未配置主機名稱與IP地址的映射關係,補全主機名稱與IP地址的映射關係。
(2)從datanode主機ping master節點的主機名稱(注意也是節點的主機名稱),如果ping不通,原因可能是datenode節點的/etc/hosts 未配置主機名稱與IP地址的映射關係,補全主機名稱與IP地址的映射關係。
(3)查看各機器節點的防火牆是否關閉(或者設定防火牆開啟,但對我們的指定連接埠開放,最好是關閉防火牆):
以下針對不同版本的Linux系統檢查防火牆的狀態,及關閉防火牆:
---------------------------------------------------------------
Ubuntu(ubuntu-12.04-desktop-amd64)
查看防火牆狀態:ufw status
關閉防火牆:ufw disable
---------------------------------------------------------------
centos6.0
查看防火牆狀態:service iptables status
關閉防火牆:chkconfig iptables off #開機不啟動防火牆服務
--------------------------------------------------------------
centos7.0(預設是使用firewall作為防火牆,如若未改為iptables防火牆,使用以下命令查看和關閉防火牆)
查看防火牆狀態:firewall-cmd --state
關閉防火牆:systemctl stop firewalld.service
著作權聲明:本文為博主原創文章,未經博主允許不得轉載。
hadoop問題之java.net.NoRouteToHostException: 沒有到主機的路由