首页 > 解决方案 > 使用 Spring Boot 纱线连接到带有后缀的资源管理器

问题描述

我正在创建一个 Spring Boot 应用程序,它使用 Yarn 作为资源管理器。我正在使用客户端的下一个 application.yml 配置:

spring:
    hadoop:
        resources:
            - file:/etc/hadoop/conf/core-site.xml
            - file:/etc/hadoop/conf/yarn-site.xml
            - file:/etc/hadoop/conf/hdfs-site.xml
    yarn:
        appName: "sby-test"
        applicationDir: "/app/sby-test"
        client:
            files:
                - "file:container.jar"
                - "file:appmaster.jar"
            localizer:
                patterns:
                    - "*.jar"
                    - "*.yml"
                    - "*.properties"
            launchcontext:
                archiveFile: appmaster.jar

它运行良好,当 yarn-site.xml 包含参数时

<property>
    <name>yarn.resourcemanager.address</name>
    <value>127.0.0.1:8032</value>
</property>

但是当我尝试在具有多个纱线地址的集群上启动此应用程序时,例如

<property>
    <name>yarn.resourcemanager.address.yarn1</name>
    <value>127.0.0.1:8032</value>
</property>
<property>
    <name>yarn.resourcemanager.address.yarn2</name>
    <value>127.0.0.2:8032</value>
</property>

它失败了,但有一个例外

Caused by: org.springframework.yarn.YarnSystemException: Call From node1.of.the.cluster/127.0.0.1 to 0.0.0.0:8032 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused;

它没有找到任何资源管理器地址,可能是因为 yarn-site.xml 文件中没有 yarn.resourcemanager.address 属性。

有什么方法可以设置一个后缀(例如,在我的例子中是 yarn1),当它查找资源管理器地址时,它将由 spring boot 应用?

标签: springspring-boothadoophadoop-yarn

解决方案


推荐阅读