복붙노트

[HADOOP] Java 클라이언트를 통해 Hadoop 작업 정보를 가져올 수 없습니다

HADOOP

Java 클라이언트를 통해 Hadoop 작업 정보를 가져올 수 없습니다

Hadoop 1.2.1을 사용하고 있으며 Java 클라이언트를 통해 작업 세부 정보를 인쇄하려고하지만 아무것도 인쇄하지 않습니다. 여기의 Java 코드가 있습니다.

    Configuration configuration = new Configuration();
    configuration.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));
    configuration.addResource(new Path("/usr/local/hadoop/conf/hdfs-site.xml"));
    configuration.addResource(new Path("/usr/local/hadoop/conf/mapred-site.xml")); 
    InetSocketAddress jobtracker = new InetSocketAddress("localhost", 54311);
    JobClient jobClient;
    jobClient = new JobClient(jobtracker, configuration);
    jobClient.setConf(configuration);
    JobStatus[] jobs = jobClient.getAllJobs();
    System.out.println(jobs.length);//it is printing 0.
    for (int i = 0; i < jobs.length; i++) {
        JobStatus js = jobs[i];
        JobID jobId = js.getJobID();
        System.out.println(jobId);
    }

그러나 작업 추적기 기록에서 세 가지 작업을 볼 수 있습니다. 스크린 샷입니다 어느 몸이 잘못 가고 있는지 말해 줄 수 있습니까? 모든 작업 세부 정보를 인쇄하고 싶습니다.

그리고 내 구성 파일은 다음과 같습니다.

core-site.xml

<configuration>
<property>
<name>hadoop.tmp.dir</name
<value>/data/tmp</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:54310</value>
<description>The name of the default file system.  A URI whose</description>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:54310</value>
<description>The name of the default file system.  A URI whose
scheme and authority determine the FileSystem implementation.  The
uri's scheme determines the config property (fs.SCHEME.impl) naming
the FileSystem implementation class.  The uri's authority is used to
determine the host, port, etc. for a filesystem.</description>
</property>
</configuration>

hdfs-site.xml

<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
<description>Default block replication.  The actual number of replications can be specified when the file is created. The default is used if replication is not specified in create time.
</description>
</property>
</configuration>

mapred-site.xml

<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:54311</value>
<description>The host and port that the MapReduce job tracker runs at. If "local", then jobs are run in-process as a single map and reduce task.
</description>
</property>
</configuration>

해결법

  1. ==============================

    1.이런 식으로 해보십시오

    이런 식으로 해보십시오

    jobClient.displayTasks(jobID, "map", "completed");
    

    작업 ID는

    JobID jobID = new JobID(jobIdentifier, jobNumber);
    

    또는

    TaskReport[] taskReportList =   jobClient.getMapTaskReports(jobID);
    
  2. from https://stackoverflow.com/questions/22412423/unable-to-get-hadoop-job-information-through-java-client by cc-by-sa and MIT license