복붙노트

[HADOOP] 일반적인 옵션을 파서를 통해 mapreduce.job.reduces을 설정할 수 없습니다

HADOOP

일반적인 옵션을 파서를 통해 mapreduce.job.reduces을 설정할 수 없습니다

hadoop jar MapReduceTryouts-1.jar invertedindex.simple.MyDriver -D mapreduce.job.reduces=10 /user/notprabhu2/Input/potter/ /user/notprabhu2/output

나는 GenericOptionParser에서 제공하는 -D 옵션을 통해 감속기의 수를 설정하기 위해 헛된 시도하고있다 그러나 작동하지 않는 것 내가 왜 아무 생각이 없습니다.

나는 시도 -D mapreduce.job.reduces = (-D 후 공간)와 10도

-Dmapreduce.job.reduces = 10 아무것도하지만, (-D 후 공백없이) 회피로 보인다.

내 드라이버 클래스에서 나는 도구를 구현했습니다.

package invertedindex.simple;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

public class MyDriver extends Configured implements Tool {

    @Override
    public int run(String[] args) throws Exception {

        Configuration conf = getConf();
        Job job = Job.getInstance(conf);

        job.setJarByClass(MyDriver.class);

        Path outputPath =  new Path(args[1]);
        outputPath.getFileSystem(getConf()).delete(outputPath, true);

        job.setMapperClass(MyMapper.class);
        job.setReducerClass(MyReducer.class);

        job.setInputFormatClass(TextInputFormat.class);
        job.setOutputFormatClass(TextOutputFormat.class);

        TextInputFormat.addInputPath(job, new Path(args[0]));
        TextOutputFormat.setOutputPath(job, outputPath);

        job.setNumReduceTasks(3);

        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(Text.class);
        return job.waitForCompletion(true) ? 0 : 1;

    }

    public static void main(String[] args) throws Exception {
        int exitCode = ToolRunner.run(new Configuration(),new MyDriver(), args);
        System.exit(exitCode);
    }

}

내가 명시 적으로 내 드라이버 코드에 3 감속기의 수를 설정 한 이후로 난 항상 3 감속기와 끝까지.

나는 구글 컴퓨 트 엔진에 2 노드 클러스터에 하둡 2.6.0이 CDH 5.4.7을 사용하고 있습니다.

해결법

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

    1.그것을 알아 냈다. 그래서 바보로 판명하지만 여전히 경우 누군가가 같은 어리석은 실수를하지 그냥 대답을 게시.

    그것을 알아 냈다. 그래서 바보로 판명하지만 여전히 경우 누군가가 같은 어리석은 실수를하지 그냥 대답을 게시.

    보이는 job.setNumReduceTasks (3); 내 드라이버 클래스의 라인은 명령 줄에서 =은 -D mapreduce.job.reduces 이상 (10)을 우선하고있다.

    I는 thejob.setNumReduceTasks를 제거하면 (3); 내 코드 모두에서 라인 괜찮 았는데.

  2. ==============================

    2.이경 번호의 속성을 설정 - XML ​​태그에 mapreduce.job.reduces

    이경 번호의 속성을 설정 - XML ​​태그에 mapreduce.job.reduces

    구성에서 코드에 의해 호출됩니다 mapred-site.xml 파일에 속성을 설정합니다 :

    <property>
        <name>mapreduce.job.reduces</name>
        <value>5</value>
    </property>
    

    재발 하둡 과정

  3. from https://stackoverflow.com/questions/33237361/unable-to-set-mapreduce-job-reduces-through-generic-option-parser by cc-by-sa and MIT license