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系统检查防火墙的状态,及关闭防火墙:
对了 记得确认这两处路径一致
core-site.xml 下面的 hadoop.tmp.dir的路径和 hdfs-site.xml 下面 的dfs.datanode.data.dir路径要一样
---------------------------------------------------------------
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
---------------------
作者:lsxy117
来源:优快云
原文:https://blog.youkuaiyun.com/lsxy117/article/details/47217161
版权声明:本文为博主原创文章,转载请附上博文链接!