背景
今天在公司搭建了一个hadoop集群。用的服务器是centos7.5。一切都十分正常,启动以后,所有的进程都在。唯一不正常的是居然Web UI打不开了。而且我注意到就是单纯的连接不上,浏览器并没有显示拒绝连接之类的字眼。客户端和服务器相互也能够ping通。
因为发现集群是正常的,linux使用 curl master:50070查看发现也有网页返回。所以感觉问题不大,到饭点了,就去吃饭了。
微信公众号:大数据报文
问题解决
饭后回来发现,yarn的相关节点挂掉了,有点紧张。不过还好,有错误总比没错误好,于是乎先把集群停掉,然后去看了yarn的相关日志,报了下面的错误:
Caused by: java.net.NoRouteToHostException: No Route to Host from slave45/**.**.***.** to master:8031 failed on socket timeout exception: java.net.NoRouteToHostException: No route to host; For more details see: http://wiki.apache.org/hadoop/NoRouteToHost
at sun.reflect.GeneratedConstructorAccessor27.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:792)
at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:758)
at org.apache.hadoop.ipc.Client.call(Client.java:1480)
at org.apache.hadoop.ipc.Client.call(Client.java:1413)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:229)
at com.sun.proxy.$Proxy73.registerNodeManager(Unknown Source)
at org.apache.hadoop.yarn.server.api.impl.pb.client.ResourceTrackerPBClientImpl.registerNodeManager(ResourceTrackerPBClientImpl.java:68)
at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:191)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
at com.sun.proxy.$Proxy74.registerNodeManager(Unknown Source)
at org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdaterImpl.registerWithRM(NodeStatusUpdaterImpl.java:270)
at org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdaterImpl.serviceStart(NodeStatusUpdaterImpl.java:197)
... 6 more
看到错误第一反应,是不是dns映射没配置全?查看/ect/hosts发现集群都已经配置过了。
这时候突然想起来,防火墙好像没有关。对,集群用的服务器都是全新的,应该是没有关。用了centos6的命令:service iptables status,发现报错了
[root@localhost /]# service iptables status
Redirecting to /bin/systemctl status iptables.service
Unit iptables.service could not be found.
哈?没有防火墙的意思吗???
当然不可能!!!
还好我机灵,记起来centos7已经不用centos6的iptables了,赶紧查了centos7的防火墙命令
[root@localhost /]# firewall-cmd --state
running
如上,果然防火墙开着,问题简单了,将所有防火墙关掉,并设置禁止开机自启,重启hadoop集群,搞定!
centos7关闭防火墙:
systemctl stop firewalld.service
centos7禁止防火墙开机自启
systemctl disable firewalld.service