Hadoop1.x安装:关于错误没有到主机的路由

当我们在名字节点开启hadoop后,我们转到数据节点使用jps查看当前运行的服务时会发现hadoop的相关服务并没有启动,我们查看错误日志会发现启动时出现了错误,启动失败。
错误详情:

2017-03-08 04:37:30,258 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Call to tiny1/192.168.132.101: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.$Proxy5.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)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
        at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
        at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:511)
        at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:481)
        at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:457)
        at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:583)
        at org.apache.hadoop.ipc.Client$Connection.access$2200(Client.java:205)
        at org.apache.hadoop.ipc.Client.getConnection(Client.java:1249)
        at org.apache.hadoop.ipc.Client.call(Client.java:1093)
        ... 16 more

这是由于防火墙没有关闭,我们使用root权限关闭tiny1的防火墙


[root@tiny1 grid]# service iptables status
表格:filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0
3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22
5    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination
1    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination

[root@tiny1 grid]# service iptables stop
iptables:清除防火墙规则:                                 [确定]
iptables:将链设置为政策 ACCEPT:filter                    [确定]
iptables:正在卸载模块:                                   [确定]
[root@tiny1 grid]# service iptables status
iptables:未运行防火墙。

重启hadoop

[grid@tiny1 ~]$ hadoop/hadoop-1.2.1/bin/stop-all.sh
stopping jobtracker
tiny3: no tasktracker to stop
tiny2: no tasktracker to stop
stopping namenode
tiny3: no datanode to stop
tiny2: no datanode to stop
tiny1: stopping secondarynamenode
[grid@tiny1 ~]$ hadoop/hadoop-1.2.1/bin/start-all.sh
starting namenode, logging to /home/grid/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-grid-namenode-tiny1.out
tiny3: starting datanode, logging to /home/grid/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-grid-datanode-tiny3.out
tiny2: starting datanode, logging to /home/grid/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-grid-datanode-tiny2.out
tiny1: starting secondarynamenode, logging to /home/grid/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-grid-secondarynamenode-tiny1.out
starting jobtracker, logging to /home/grid/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-grid-jobtracker-tiny1.out
tiny3: starting tasktracker, logging to /home/grid/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-grid-tasktracker-tiny3.out
tiny2: starting tasktracker, logging to /home/grid/hadoop/hadoop-1.2.1/libexec/../logs/hadoop-grid-tasktracker-tiny2.out

登陆slave节点查看

j[grid@tiny2 ~]$ java/jdk1.8.0_121/bin/jps
2006 Jps
1830 DataNode
1903 TaskTracker

成功(注意这种办法只是临时关闭防火墙)

posted on 2017-07-22 20:40  erygreat  阅读(649)  评论(0编辑  收藏  举报

导航