2017-01-17 12 views
0

私はMap Reduceジョブで作業しており、ToolRunnerのrunメソッドを使用して実行しています。予想通りうまく実行map reduce jobがlocalhost:8080になっているのはなぜですか?

public class MaxTemperature extends Configured implements Tool { 

    public static void main(String[] args) throws Exception { 
     System.setProperty("hadoop.home.dir", "/"); 
     int exitCode = ToolRunner.run(new MaxTemperature(), args); 
     System.exit(exitCode); 
    } 

    @Override 
    public int run(String[] args) throws Exception { 
     if (args.length != 2) { 
       System.err.println("Usage: MaxTemperature <input path> <output path>"); 
       System.exit(-1); 
      } 
     System.out.println("Starting job"); 
     Job job = new Job(); 
     job.setJarByClass(MaxTemperature.class); 
     job.setJobName("Max temperature"); 

     FileInputFormat.addInputPath(job, new Path(args[0])); 
     FileOutputFormat.setOutputPath(job, new Path(args[1])); 

     job.setMapperClass(MaxTemperatureMapper.class); 
     job.setReducerClass(MaxTemperatureReducer.class); 

     job.setOutputKeyClass(Text.class); 
     job.setOutputValueClass(IntWritable.class); 
     int returnValue = job.waitForCompletion(true) ? 0:1; 

     if(job.isSuccessful()) { 
      System.out.println("Job was successful"); 
     } else if(!job.isSuccessful()) { 
      System.out.println("Job was not successful");   
     } 
     return returnValue; 
    } 
} 

仕事: はここに私のコードです。しかし、ジョブの追跡情報を表示するログを調べると、マップの縮小がジョブの追跡のためにlocalhost:8080を指していることがわかりました。ここで

は、ログのスナップショットです:

20521 [main] INFO org.apache.hadoop.mapreduce.JobSubmitter - number of splits:1 
20670 [main] INFO org.apache.hadoop.mapreduce.JobSubmitter - Submitting tokens for job: job_local1454583076_0001 
20713 [main] WARN org.apache.hadoop.conf.Configuration - file:/tmp/hadoop-KV/mapred/staging/KV1454583076/.staging/job_local1454583076_0001/job.xml:an attempt to override final parameter: mapreduce.job.end-notification.max.retry.interval; Ignoring. 
20716 [main] WARN org.apache.hadoop.conf.Configuration - file:/tmp/hadoop-KV/mapred/staging/KV1454583076/.staging/job_local1454583076_0001/job.xml:an attempt to override final parameter: mapreduce.job.end-notification.max.attempts; Ignoring. 
20818 [main] WARN org.apache.hadoop.conf.Configuration - file:/tmp/hadoop-KV/mapred/local/localRunner/KV/job_local1454583076_0001/job_local1454583076_0001.xml:an attempt to override final parameter: mapreduce.job.end-notification.max.retry.interval; Ignoring. 
20820 [main] WARN org.apache.hadoop.conf.Configuration - file:/tmp/hadoop-KV/mapred/local/localRunner/KV/job_local1454583076_0001/job_local1454583076_0001.xml:an attempt to override final parameter: mapreduce.job.end-notification.max.attempts; Ignoring. 
**20826 [main] INFO org.apache.hadoop.mapreduce.Job - The url to track the job: http://localhost:8080/** 
20827 [main] INFO org.apache.hadoop.mapreduce.Job - Running job: job_local1454583076_0001 
20829 [Thread-10] INFO org.apache.hadoop.mapred.LocalJobRunner - OutputCommitter set in config null 

だから私の質問は、なぜマップがローカルホストを指して削減されているジョブを追跡するために、8080

URLを:http://localhost:8080/

私は手動でこれを設定する構成ファイルやプロパティファイルはありません。また、他のポートに変更することは可能でしょうか?はいの場合、これをどのように達成できますか?

+0

ローカルモードまたはクラスタで実行していますか? – Venkat

+1

ApplicationMaster Web UIのデフォルトポートである 'localhost:8088'にする必要があります。 – franklinsijo

+0

ローカルモードとその8080のみ – KayV

答えて

0

私たちは、デフォルトの設定を変更し、構成オブジェクトを作成し、プロパティを設定する必要があります次のようにこのコンフィグレーションを使用してJobオブジェクトを作成します。

Configuration configuration = getConf(); 

    //configuration.set("fs.defaultFS", "hdfs://192.**.***.2**"); 
    //configuration.set("mapred.job.tracker", "jobtracker:jtPort"); 
    configuration.set("mapreduce.jobtracker.address", "localhost:54311"); 
    configuration.set("mapreduce.framework.name", "yarn"); 
    configuration.set("yarn.resourcemanager.address", "127.0.0.1:8032"); 

    //configuration.set("yarn.resourcemanager.webapp.address", "127.0.0.1:8032"); 

    //Initialize the Hadoop job and set the jar as well as the name of the Job 
    Job job = new Job(configuration); 
1

ので、ポートは糸-site.xmlで構成されます:yarn-site.xml

チェック:yarn.resourcemanager.webapp.address

関連する問題