首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JobTracker源代码修改

JobTracker源代码修改
EN

Stack Overflow用户
提问于 2015-03-06 15:45:37
回答 1查看 78关注 0票数 0

我是一个学习MapReduce研究的学生。现在,我已经设计了一个MapReduce调度消息。我会实现这个算法。为了验证该算法,我在原始Hadoop代码上添加了一些打印消息,例如JobTracker.java、FairScheduler.java等。但是,在重新编译代码之后,打印消息不会显示在显示器上.我无法验证算法的正确性。

例如,src/mapred/org/apache/hadoop/mapred/JobTracker.java中的修改代码如下所示。

代码语言:javascript
复制
...

public static JobTracker startTracker(JobConf conf
                                        ) throws IOException,
                                                 InterruptedException {       System.out.println("Hello! World!!!");
    return startTracker(conf, generateNewIdentifier());   }

  public static JobTracker startTracker(JobConf conf, String identifier)    throws IOException, InterruptedException {    System.out.println("Hello! World!!!");    return startTracker(conf, identifier, false);   }
     public static JobTracker startTracker(JobConf conf, String identifier, boolean initialize)    throws IOException, InterruptedException {     System.out.println("Hello! World!!!");    DefaultMetricsSystem.initialize("JobTracker");
    JobTracker result = null;
    while (true) {
        System.out.println("Hello! World!!!");
      try {
        result = new JobTracker(conf, identifier);
        result.taskScheduler.setTaskTrackerManager(result);
        break;
      } catch (VersionMismatch e) {
        throw e;
      } catch (BindException e) {
        throw e;
      } catch (UnknownHostException e) {
        throw e;
      } catch (AccessControlException ace) {
        // in case of jobtracker not having right access
        // bail out
        throw ace;
      } catch (IOException e) {
        LOG.warn("Error starting tracker: " + 
                 StringUtils.stringifyException(e));
      }
      Thread.sleep(1000);
    }
    if (result != null) {
        System.out.println("Hello! World!!!");
      JobEndNotifier.startNotifier();
      MBeans.register("JobTracker", "JobTrackerInfo", result);
      if(initialize == true) {
          System.out.println("Hello! World!!!");
        result.setSafeModeInternal(SafeModeAction.SAFEMODE_ENTER);
        result.initializeFilesystem();
        result.setSafeModeInternal(SafeModeAction.SAFEMODE_LEAVE);
        result.initialize();
      }
    }
    return result;   }

...

我编译了修改过的代码,并用命令替换了原来的Hadoop:

代码语言:javascript
复制
cd $HADOOP_HOME
ant
mv build/hadoop-client-1.2.2-SNAPSHOT.jar hadoop-client-1.2.1.jar
mv build/hadoop-core-1.2.2-SNAPSHOT.jar hadoop-core-1.2.1.jar
mv build/hadoop-minicluster-1.2.2-SNAPSHOT.jar hadoop-minicluster-1.2.1.jar
mv build/hadoop-tools-1.2.2-SNAPSHOT.jar hadoop-tools-1.2.1.jar

然后,我启动了Hadoop的新版本。它没有显示“你好!世界!”我显示器上的留言。

如果你知道原因,请告诉我。在编译或执行过程中,是否需要添加一些参数?非常感谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-03-10 09:07:04

默认情况下,Hadoop守护进程的输出在$HADOOP_HOME/ *.out文件夹下捕获。您应该能够在那里找到输出消息。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28902360

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档