LocalJobRunner 上仅 Hadoop 作业 运行
Hadoop job only running on LocalJobRunner
这里是 Hadoop 初学者。我有以下 运行 和主要方法:
public int run(String[] args) throws Exception {
Job job = new Job();
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
job.setMapperClass(Map.class);
job.setReducerClass(Reduce.class);
job.setInputFormatClass(TextInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);
FileInputFormat.setInputPaths(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
job.submit();
return 0;
}
public static void main(String[] args) throws Exception {
Tool myTool = new Extractor();
Configuration config = new Configuration();
config.set("mapred.job.tracker", "<IP>:9001");
config.set("fs.default.name", "hdfs://<IP>:9000");
myTool.setConf(config);
ToolRunner.run(myTool, new String[]{"<file>.json", "output"});
}
出于某种原因,这 运行ning 很好,但仅限于本地计算机。这是直接从 eclipse 中 运行。虽然工作跟踪器在技术上是在同一个盒子上,但它从未收到任何工作。我的配置有什么问题?
核心-site.xml是:
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs:/<IP>:9000</value>
</property>
</configuration>
您是如何提交工作的。
您的客户端可能没有读取正确的配置文件。确保你的 mapred-site.xml 上有这样的东西。既然你是从你的代码中传递这个,它应该没问题。
<property>
<name>mapred.job.tracker</name>
<value>localhost:8021</value>
</property>
还要确保你没有通过
-Dmapred.job.tracker=local
当你运行这份工作
并在 运行 方法中创建您的配置,以便您可以这样做。
作业=新作业(conf);
这里是 Hadoop 初学者。我有以下 运行 和主要方法:
public int run(String[] args) throws Exception {
Job job = new Job();
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
job.setMapperClass(Map.class);
job.setReducerClass(Reduce.class);
job.setInputFormatClass(TextInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);
FileInputFormat.setInputPaths(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
job.submit();
return 0;
}
public static void main(String[] args) throws Exception {
Tool myTool = new Extractor();
Configuration config = new Configuration();
config.set("mapred.job.tracker", "<IP>:9001");
config.set("fs.default.name", "hdfs://<IP>:9000");
myTool.setConf(config);
ToolRunner.run(myTool, new String[]{"<file>.json", "output"});
}
出于某种原因,这 运行ning 很好,但仅限于本地计算机。这是直接从 eclipse 中 运行。虽然工作跟踪器在技术上是在同一个盒子上,但它从未收到任何工作。我的配置有什么问题?
核心-site.xml是:
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs:/<IP>:9000</value>
</property>
</configuration>
您是如何提交工作的。
您的客户端可能没有读取正确的配置文件。确保你的 mapred-site.xml 上有这样的东西。既然你是从你的代码中传递这个,它应该没问题。
<property>
<name>mapred.job.tracker</name>
<value>localhost:8021</value>
</property>
还要确保你没有通过
-Dmapred.job.tracker=local
当你运行这份工作
并在 运行 方法中创建您的配置,以便您可以这样做。
作业=新作业(conf);