Hadoop JobClient.runJob:无法初始化群集 - 误导性错误消息(?)和建议的解决方案

时间:2013-12-18 13:23:57

标签: java hadoop mapreduce cluster-computing yarn

(我现在通过添加本帖子末尾指定的依赖项解决了这个问题,但是想知道是否有更好的替代方案,或者我是否错过了重要的内容?)

尝试运行mapreduce作业时,行

JobClient.runJob(conf)

给出以下错误堆栈:

Exception in thread "main" java.io.IOException: Cannot initialize Cluster. Please check your     configuration for mapreduce.framework.name and the correspond server addresses.
    at org.apache.hadoop.mapreduce.Cluster.initialize(Cluster.java:119)
    at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:81)
    at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:74)
    at org.apache.hadoop.mapred.JobClient.init(JobClient.java:465)
    at org.apache.hadoop.mapred.JobClient.<init>(JobClient.java:444)
    at org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:826)

我的设置如下:

public static void main(String[] args) throws IOException {
    JobConf conf = new JobConf(Reduce.class);          
    conf.set("mapreduce.framework.name","yarn");
    conf.set("mapreduce.jobhistory.address","s17.myserver.com:10020");
    conf.set("mapreduce.jobhistory.webapp.address","s17.myserver.com:19888");

    conf.set("yarn.resourcemanager.address","s6.myserver.com:8032");
    conf.set("yarn.resourcemanager.scheduler.address","s6.myserver.com:8030");
    conf.set("yarn.resourcemanager.resource-tracker.address","s6.myserver.com:8031");
    conf.set("yarn.resourcemanager.admin.address","s6.myserver.com:8033");
    conf.set("yarn.resourcemanager.webapp.address","s6.myserver.com:8088");

    /// error on the following line
    JobClient.runJob(conf);
}

在花费大量时间尝试检查并重新检查我的配置之后,我设法通过向我的项目添加以下依赖项来解决问题:

Hadoop的MapReduce的客户端 - jobclient

我在这里遗漏了什么,或者错误消息只是一个特别误导的消息?

1 个答案:

答案 0 :(得分:0)

此类配置应由群集管理员完成,并作为yarn-site的一部分提供。每个工作都不应该添加它。话虽这么说,错误信息并没有特别的帮助,可以改进,但对于Hadoop中的几乎所有错误信息都是如此......