编程语言
首页 > 编程语言> > Hadoop解决 java.net.BindException: Port in use: hadoop103:8088

Hadoop解决 java.net.BindException: Port in use: hadoop103:8088

作者:互联网

java.net.BindException: Port in use: hadoop103:8088
        at org.apache.hadoop.http.HttpServer2.constructBindException(HttpServer2.java:1213)
        at org.apache.hadoop.http.HttpServer2.bindForSinglePort(HttpServer2.java:1235)
        at org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:1294)
        at org.apache.hadoop.http.HttpServer2.start(HttpServer2.java:1149)
        at org.apache.hadoop.yarn.webapp.WebApps$Builder.start(WebApps.java:439)
        at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.startWepApp(ResourceManager.java:1203)
        at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.serviceStart(ResourceManager.java:1312)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:194)
        at org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.main(ResourceManager.java:1507)
Caused by: java.net.BindException: 无法指定被请求的地址
        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.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:351)
                                                                                                                     115,
去网上查的时候发现大部分都是netstat grep一下自己的端口号是否被占用什么的,查完之后发现并没有。
直到最近发现问题,在我的yarn-site.xml文件中配置的
    <!-- 指定ResourceManager的地址-->
    <property>
        <name>yarn.resourcemanager.hostname</name>
        <value>hadoop103</value>
    </property>
才明白,启动yarn的时候必须在你这个resoucemanager的地址才可以。由于以前懒省事,想在一台机子上直接start-all.sh。但是最近考虑到负载均衡问题,所以要手动配置一下resourcemanager和2nn的地址。而start-all.sh = (在一台机子上)start-dfs.sh + start-yarn.sh 这样很容易导致负载不均衡。使用此命令的时候也会报提示 This is deprecated。

下面粘上群起脚本hdp.sh(在~/bin/目录下创建)
我的集群规划是

在这里插入图片描述

#!/bin/bash
if [ $# -lt 1 ]
then
    echo "No Args Input..."
    exit ;
fi
case $1 in
"start")
        echo " =================== 启动 hadoop集群 ==================="
#路径要是自己的路径才可以 用户名别忘了修改!
#以下都根据自己的实际路径来配置
        echo " --------------- 启动 hdfs ---------------"
        ssh hadoop102 "/opt/module/hadoop-3.1.3/sbin/start-dfs.sh"
        echo " --------------- 启动 yarn ---------------"
        ssh hadoop103 "/opt/module/hadoop-3.1.3/sbin/start-yarn.sh"
        #historyserver
        echo " --------------- 启动 historyserver ---------------"
        ssh hadoop102 "/opt/module/hadoop-3.1.3/bin/mapred --daemon start historyserver"
;;
"stop")
        echo " =================== 关闭 hadoop集群 ==================="

        echo " --------------- 关闭 historyserver ---------------"
        ssh hadoop102 "/opt/module/hadoop-3.1.3/bin/mapred --daemon stop historyserver"
        echo " --------------- 关闭 yarn ---------------"
        ssh hadoop103 "/opt/module/hadoop-3.1.3/sbin/stop-yarn.sh"
        echo " --------------- 关闭 hdfs ---------------"
        ssh hadoop102 "/opt/module/hadoop-3.1.3/sbin/stop-dfs.sh"
;;
*)
    echo "Input Args Error..."
;;
esac

标签:use,java,8088,hadoop,yarn,echo,---------------,start
来源: https://blog.csdn.net/weixin_43950862/article/details/114481146