hadoop問題之java.net.NoRouteToHostException: 沒有到主機的路由

來源:互聯網
上載者:User

標籤:沒有到主機的路由   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: 沒有到主機的路由

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.