今天早上同学让我帮忙启动了下集群,首先就要启动hadoop,jps进程看了下:
2128 QuorumPeerMain
12178 Jps
8259 SecondaryNameNode
7993 NameNode
发现Hadoop的namenode和secondarynamenode都起来了,但是resourcemanager却没有起来,但是感觉配置都没有错,这个时候去查看了日志,
cd /usr/local/hadoop/logs
tail -500 yarn-hadoop-resourcemanager-hbase1.log
发现日志中报错了,内容如下:
2018-01-16 09:10:17,735 FATAL org.apache.hadoop.yarn.server.resourcemanager.ResourceManager: Error starting ResourceManager
org.apache.hadoop.yarn.webapp.WebAppException: Error starting http server
at org.apache.hadoop.yarn.webapp.WebApps$Builder.start(WebApps.java:278)
at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.startWepApp(ResourceManager.java:979)
at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.serviceStart(ResourceManager.java:1079)
at org.apache.hadoop.service.AbstractService.start(AbstractService.java:193)
at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.main(ResourceManager.java:1211)
Caused by: java.net.BindException: Port in use: 172.17.168.96:8088
at org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:891)
at org.apache.hadoop.http.HttpServer2.start(HttpServer2.java:827)
at org.apache.hadoop.yarn.webapp.WebApps$Builder.start(WebApps.java:273)
... 4 more
Caused by: java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216)
at org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:886)
认真查看以下这条报错信息:
Caused by: java.net.BindException: Port in use: 172.17.168.96:8088
原来是节点的ip发生了变化,然后配置文件没有及时修改,所以才导致resourcemanager没有正常启动。
解决方案:
首先用ifconfig查看下自己节点的ip,然后修改yarn-site.xml中的
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>172.17.174.67:8088</value>
</property>
将相应的ip即可,最后重启hadoop,jps查看:
2128 QuorumPeerMain
13724 NameNode
14188 ResourceManager
18189 Jps
13997 SecondaryNameNode
hadoop启动正常,50070和8088端口都可以正常访问。