You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法运行/调度Oozie示例MapReduce任务,出现java.net.ConnectException错误

解决Oozie运行MapReduce示例时的HDFS连接拒绝问题

环境信息

  • Hadoop 2.6.0
  • Oozie 5.2.0

错误现象

运行Oozie示例MapReduce任务时出现连接拒绝错误:

hadoop1@ip-172-31-84-37:/usr/local/oozie-5.2.0/examples/target/examples/apps/map-reduce$ oozie job -oozie http://localhost:11000/oozie -config job.properties -run
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/oozie/oozie-5.2.0/embedded-oozie-server/webapp/WEB-INF/lib/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/oozie/oozie-5.2.0/embedded-oozie-server/webapp/WEB-INF/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/oozie/oozie-5.2.0/libext/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Error: E0307 : E0307: Runtime error [Could not check whether file [hdfs://localhost:8020/user/hadoop1/examples/apps/map-reduce/workflow.xml] exists on HDFS. Error message: Call From ip-172-31-84-37/172.31.84.37 to localhost:8020 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused]

错误截图

排查与解决步骤

1. 确认HDFS服务状态

  • 执行jps命令,检查是否存在NameNode和DataNode进程:
    jps
    
  • 若进程未启动,执行以下命令启动HDFS:
    start-dfs.sh
    

2. 修正HDFS地址配置

  • 打开$HADOOP_HOME/etc/hadoop/core-site.xml,确保fs.defaultFS使用机器实际IP或主机名(不要用localhost):
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://ip-172-31-84-37:8020</value>
    </property>
    

3. 测试HDFS连接可用性

  • 执行基础命令验证HDFS可访问:
    hdfs dfs -ls /
    
  • 用实际IP直接测试连接:
    hdfs dfs -ls hdfs://ip-172-31-84-37:8020/
    

4. 调整Oozie任务配置

  • 打开示例任务的job.properties文件,更新nameNode为正确的HDFS地址:
    nameNode=hdfs://ip-172-31-84-37:8020
    jobTracker=ip-172-31-84-37:8032
    queueName=default
    examplesRoot=examples
    oozie.wf.application.path=${nameNode}/user/${user.name}/${examplesRoot}/apps/map-reduce
    

5. 修复主机名解析

  • 编辑/etc/hosts文件,添加机器IP与主机名的映射:
    172.31.84.37    ip-172-31-84-37
    
  • 避免依赖公网DNS,优先使用本地映射或集群内部解析。

内容的提问来源于stack exchange,提问作者Sai

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 13:24:21