环境:
hadoop2.2、JDK1.7
集群:
node51: namenode/datanode/nodemanager/
node52: secondarynamenode/datanode/nodemanager/ historyserver
node53: resourcemanager/datanode/nodemanager/sqoop
问题描述:
在配置好hadoop集群后,使用命令start-all.sh (或 start-dfs.sh,start-yarn.sh)启动集群时,发现node53上出现如下的错误:
java.net.BindException: Port in use: node53:8088 at org.apache.hadoop.http.HttpServer.openListener(HttpServer.java:742) at org.apache.hadoop.http.HttpServer.start(HttpServer.java:686) at org.apache.hadoop.yarn.webapp.WebApps$Builder.start(WebApps.java:257) at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.startWepApp(ResourceManager.java:623) at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.serviceStart(ResourceManager.java:655) at org.apache.hadoop.service.AbstractService.start(AbstractService.java:193) at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.main(ResourceManager.java:872) 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:444) at sun.nio.ch.Net.bind(Net.java:436) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216) at org.apache.hadoop.http.HttpServer.openListener(HttpServer.java:738) ... 6 more网上找了一些解决方案也没有解决,后来,忽然想到之前使用伪分布式部署就没有问题,所以就想到了在node51上面部署resourcemanager。
修改完配置文件后,再次启动,发现historyserver,启动不了
2016-03-13 00:11:24,651 INFO org.apache.hadoop.http.HttpServer: HttpServer.start() threw a non Bind IOException java.net.BindException: Port in use: node52:19888 at org.apache.hadoop.http.HttpServer.openListener(HttpServer.java:742) at org.apache.hadoop.http.HttpServer.start(HttpServer.java:686) at org.apache.hadoop.yarn.webapp.WebApps$Builder.start(WebApps.java:257) at org.apache.hadoop.mapreduce.v2.hs.HistoryClientService.initializeWebApp(HistoryClientService.java:149) at org.apache.hadoop.mapreduce.v2.hs.HistoryClientService.serviceStart(HistoryClientService.java:118) at org.apache.hadoop.service.AbstractService.start(AbstractService.java:193) at org.apache.hadoop.service.CompositeService.serviceStart(CompositeService.java:121) at org.apache.hadoop.mapreduce.v2.hs.JobHistoryServer.serviceStart(JobHistoryServer.java:127) at org.apache.hadoop.service.AbstractService.start(AbstractService.java:193) at org.apache.hadoop.mapreduce.v2.hs.JobHistoryServer.launchJobHistoryServer(JobHistoryServer.java:156) at org.apache.hadoop.mapreduce.v2.hs.JobHistoryServer.main(JobHistoryServer.java:165) 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:444) at sun.nio.ch.Net.bind(Net.java:436) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216) at org.apache.hadoop.http.HttpServer.openListener(HttpServer.java:738) ... 10 more所以又把historyserver配置到node51上面,再次启动,然后就可以了。
但是,这样是有问题的,不能负载均衡。
解决方法:
如果要在node52上面部署historyserver,在node53上面部署resourcemanager,是可以的,按照下面的说明:
如果要启动historyserver,就在node52上面启动,如果要启动resourcemanager(或者说yarn),就在node53上面启动;
可以做个简单的启动脚本:
#!/bin/bash echo "starting the cluster..." #cd $HADOOP_HOME #./sbin/start-all.sh /usr/local/hadoop-2.2.0/sbin/start-dfs.sh ssh node53 /usr/local/hadoop-2.2.0/sbin/start-yarn.sh #./sbin/mr-jobhistory-daemon.sh start historyserver ssh node52 /usr/local/hadoop-2.2.0/sbin/mr-jobhistory-daemon.sh start historyserver echo "use jps to see daemon processes!"
另,如果使用hadoop2.6,则没有这个问题,直接全部在node51启动即可,所以可能的话,还是用高点的版本;
分享,成长,快乐
脚踏实地,专注
转载请注明blog地址:http://blog.csdn.net/fansy1990