gpt4 book ai didi

hadoop - 与 Action 相关的未知Hadoop作业。操作失败

转载 作者:行者123 更新时间:2023-12-02 19:14:08 26 4
gpt4 key购买 nike

我正在尝试从OOzie运行mapreduce程序。但是低于错误
JA017: Unknown hadoop job [job_local100982864_0001] associated with action [0000000-191002180059803-oozie-hdus-W@RunMapreduceJob]. Failing this action!

这是workflow.xml

<workflow-app xmlns="uri:oozie:workflow:0.4" name="simple-Workflow">
<start to="RunMapreduceJob" />
<action name="RunMapreduceJob">
<map-reduce>
<job-tracker>localhost:8088</job-tracker>
<name-node>hdfs://localhost:9000</name-node>
<prepare>
<delete path="hdfs://localhost:9000/dataoutput"/>
</prepare>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>default</value>
</property>
<property>
<name>mapred.mapper.class</name>
<value>MovieReviewsHadoop.DataDividerByUser.DataDividerMapper</value>
</property>
<property>
<name>mapred.reducer.class</name>
<value>MovieReviewsHadoop.DataDividerByUser.DataDividerReducer</value>
</property>
<property>
<name>mapred.output.key.class</name>
<value>org.apache.hadoop.io.IntWritable</value>
</property>
<property>
<name>mapred.output.value.class</name>
<value>org.apache.hadoop.io.Text</value>
</property>
<property>
<name>mapred.input.dir</name>
<value>/data</value>
</property>
<property>
<name>mapred.output.dir</name>
<value>/dataoutput</value>
</property>
</configuration>
</map-reduce>
<ok to="end" />
<error to="fail" />
</action>
<kill name="fail">
<message>Mapreduce program Failed</message>
</kill>
<end name="end" />
</workflow-app>

map 缩小程序
package MovieReviewsHadoop;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;

import java.io.IOException;

public class DataDividerByUser {
public static class DataDividerMapper extends Mapper<LongWritable, Text, IntWritable, Text> {

// MAP_Method:divide data by user

@Override
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {

//input user,movie,rating
String[] user_movie_rating = value.toString().trim().split(","); // we have 3 list here
int userID = Integer.parseInt(user_movie_rating[0]);
String movieID = user_movie_rating[1];
String rating_score = user_movie_rating[2];

context.write(new IntWritable(userID), new Text(movieID + ':' + rating_score));

}
}

public static class DataDividerReducer extends Reducer<IntWritable, Text, IntWritable, Text> {

// reduce method

@Override
public void reduce(IntWritable key, Iterable<Text> values, Context context)
throws IOException, InterruptedException {

//merge data for one user
StringBuilder strblder = new StringBuilder();
while (values.iterator().hasNext()){
strblder.append("," + values.iterator().next());
}

// key-value pair: key = userID value = movie1: rating_score, movie2: rating_score.....
context.write(key, new Text(strblder.toString().replaceFirst(",", "")));

}
}

public static void main(String[] args) throws Exception {

Configuration conf = new Configuration();

Job job = Job.getInstance(conf, "Movie");
job.setMapperClass(DataDividerMapper.class);
job.setReducerClass(DataDividerReducer.class);

job.setJarByClass(DataDividerByUser.class);

job.setInputFormatClass(TextInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);
job.setOutputKeyClass(IntWritable.class);
job.setOutputValueClass(Text.class);

TextInputFormat.setInputPaths(job, new Path(args[0]));
TextOutputFormat.setOutputPath(job, new Path(args[1]));

job.waitForCompletion(true);
}

}

我敢肯定,我在工作流.xml中做错了什么。但是不知道那是什么。

任何人都可以建议做错了什么吗?因为手动运行运行良好。

1)我是否在xml中正确提供了Mapper类?

2)我可以在xml中正确提供我的Reducer类吗?

3)我在xml中给delepath正确吗?

这也是我的 job.properties文件。
nameNode=hdfs://localhost:9000
jobTracker=localhost:8088
queueName=default
oozie.use.system.libpath=true
oozie.wf.application.path=${nameNode}/Config

更新:日志
2019-10-08 16:49:26,519  INFO ActionStartXCommand:541 - SERVER[localhost] USER[hduser] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000005-191006102551747-oozie-hdus-W] ACTION[0000005-191006102551747-oozie-hdus-W@:start:] Start action [0000005-191006102551747-oozie-hdus-W@:start:] with user-retry state : userRetryCount [0], userRetryMax [0], userRetryInterval [10]
2019-10-08 16:49:26,520 INFO ActionStartXCommand:541 - SERVER[localhost] USER[hduser] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000005-191006102551747-oozie-hdus-W] ACTION[0000005-191006102551747-oozie-hdus-W@:start:] [***0000005-191006102551747-oozie-hdus-W@:start:***]Action status=DONE
2019-10-08 16:49:26,520 INFO ActionStartXCommand:541 - SERVER[localhost] USER[hduser] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000005-191006102551747-oozie-hdus-W] ACTION[0000005-191006102551747-oozie-hdus-W@:start:] [***0000005-191006102551747-oozie-hdus-W@:start:***]Action updated in DB!
2019-10-08 16:49:26,625 INFO ActionStartXCommand:541 - SERVER[localhost] USER[hduser] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000005-191006102551747-oozie-hdus-W] ACTION[0000005-191006102551747-oozie-hdus-W@mr-node] Start action [0000005-191006102551747-oozie-hdus-W@mr-node] with user-retry state : userRetryCount [0], userRetryMax [0], userRetryInterval [10]
2019-10-08 16:49:27,201 WARN MapReduceActionExecutor:544 - SERVER[localhost] USER[hduser] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000005-191006102551747-oozie-hdus-W] ACTION[0000005-191006102551747-oozie-hdus-W@mr-node] Exception in check(). Message[JA017: Unknown hadoop job [job_local1373301427_0005] associated with action [0000005-191006102551747-oozie-hdus-W@mr-node]. Failing this action!]
org.apache.oozie.action.ActionExecutorException: JA017: Unknown hadoop job [job_local1373301427_0005] associated with action [0000005-191006102551747-oozie-hdus-W@mr-node]. Failing this action!
at org.apache.oozie.action.hadoop.JavaActionExecutor.check(JavaActionExecutor.java:1201)
at org.apache.oozie.action.hadoop.JavaActionExecutor.start(JavaActionExecutor.java:1136)
at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:228)
at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:63)
at org.apache.oozie.command.XCommand.call(XCommand.java:281)
at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:323)
at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:252)
at org.apache.oozie.service.CallableQueueService$CallableWrapper.run(CallableQueueService.java:174)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2019-10-08 16:49:27,201 WARN ActionStartXCommand:544 - SERVER[localhost] USER[hduser] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000005-191006102551747-oozie-hdus-W] ACTION[0000005-191006102551747-oozie-hdus-W@mr-node] Error starting action [mr-node]. ErrorType [FAILED], ErrorCode [JA017], Message [JA017: Unknown hadoop job [job_local1373301427_0005] associated with action [0000005-191006102551747-oozie-hdus-W@mr-node]. Failing this action!]
org.apache.oozie.action.ActionExecutorException: JA017: Unknown hadoop job [job_local1373301427_0005] associated with action [0000005-191006102551747-oozie-hdus-W@mr-node]. Failing this action!
at org.apache.oozie.action.hadoop.JavaActionExecutor.check(JavaActionExecutor.java:1201)
at org.apache.oozie.action.hadoop.JavaActionExecutor.start(JavaActionExecutor.java:1136)
at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:228)
at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:63)
at org.apache.oozie.command.XCommand.call(XCommand.java:281)
at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:323)
at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:252)
at org.apache.oozie.service.CallableQueueService$CallableWrapper.run(CallableQueueService.java:174)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2019-10-08 16:49:27,202 WARN ActionStartXCommand:544 - SERVER[localhost] USER[hduser] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000005-191006102551747-oozie-hdus-W] ACTION[0000005-191006102551747-oozie-hdus-W@mr-node] Failing Job due to failed action [mr-node]
2019-10-08 16:49:27,203 WARN LiteWorkflowInstance:544 - SERVER[localhost] USER[hduser] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000005-191006102551747-oozie-hdus-W] ACTION[0000005-191006102551747-oozie-hdus-W@mr-node] Workflow Failed. Failing node [mr-node]
2019-10-08 16:49:27,276 INFO KillXCommand:541 - SERVER[localhost] USER[hduser] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000005-191006102551747-oozie-hdus-W] ACTION[-] STARTED WorkflowKillXCommand for jobId=0000005-191006102551747-oozie-hdus-W
2019-10-08 16:49:27,312 INFO KillXCommand:541 - SERVER[localhost] USER[hduser] GROUP[-] TOKEN[] APP[map-reduce-wf] JOB[0000005-191006102551747-oozie-hdus-W] ACTION[-] ENDED WorkflowKillXCommand for jobId=0000005-191006102551747-oozie-hdus-W
2019-10-08 16:49:27,613 INFO CallbackServlet:541 - SERVER[localhost] USER[-] GROUP[-] TOKEN[-] APP[-] JOB[0000005-191006102551747-oozie-hdus-W] ACTION[0000005-191006102551747-oozie-hdus-W@mr-node] callback for action [0000005-191006102551747-oozie-hdus-W@mr-node]
2019-10-08 16:49:27,619 ERROR CompletedActionXCommand:538 - SERVER[localhost] USER[-] GROUP[-] TOKEN[] APP[-] JOB[0000005-191006102551747-oozie-hdus-W] ACTION[0000005-191006102551747-oozie-hdus-W@mr-node] XException,
org.apache.oozie.command.CommandException: E0800: Action it is not running its in [FAILED] state, action [0000005-191006102551747-oozie-hdus-W@mr-node]
at org.apache.oozie.command.wf.CompletedActionXCommand.eagerVerifyPrecondition(CompletedActionXCommand.java:77)
at org.apache.oozie.command.XCommand.call(XCommand.java:251)
at org.apache.oozie.service.CallableQueueService$CallableWrapper.run(CallableQueueService.java:174)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

2019年10月09日

我从Oozie的样本工作文件夹中获取了worflow.xml样本,该样本位于oozie的安装下,并且在HDFS中也使用了相同的文件夹结构。

请在下面更新。

更新了 workflow.xml
<workflow-app xmlns="uri:oozie:workflow:0.2" name="map-reduce-wf">
<start to="mr-node"/>
<action name="mr-node">
<map-reduce>
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<prepare>
<delete path="${nameNode}/user/${wf:user()}/${examplesRoot}/output-data/${outputDir}"/>
</prepare>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
<property>
<name>mapred.mapper.class</name>
<value>MovieReviewsHadoop.DataDividerByUser$DataDividerMapper</value>
</property>
<property>
<name>mapred.reducer.class</name>
<value>MovieReviewsHadoop.DataDividerByUser$DataDividerReducer</value>
</property>
<property>
<name>mapred.map.tasks</name>
<value>1</value>
</property>
<property>
<name>mapred.input.dir</name>
<value>/user/${wf:user()}/${examplesRoot}/input-data/text</value>
</property>
<property>
<name>mapred.output.dir</name>
<value>/user/${wf:user()}/${examplesRoot}/output-data/${outputDir}</value>
</property>
</configuration>
</map-reduce>
<ok to="end"/>
<error to="fail"/>
</action>
<kill name="fail">
<message>Map/Reduce failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
</workflow-app>

job.properties
nameNode=hdfs://localhost:9000
jobTracker=localhost:8088
queueName=default
examplesRoot=examples
user.name=hduser
oozie.wf.application.path=${nameNode}/user/${user.name}/${examplesRoot}/apps/map-reduce
outputDir=map-reduce

资料夹结构
https://prnt.sc/pgq4ea

运行后在OOzie中进行 Action 配置..!
<map-reduce xmlns="uri:oozie:workflow:0.2">
<job-tracker>localhost:8088</job-tracker>
<name-node>hdfs://localhost:9000</name-node>
<prepare>
<delete path="hdfs://localhost:9000/user/hduser/examples/output-data/map-reduce" />
</prepare>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>default</value>
</property>
<property>
<name>mapred.mapper.class</name>
<value>MovieReviewsHadoop.DataDividerByUser$DataDividerMapper</value>
</property>
<property>
<name>mapred.reducer.class</name>
<value>MovieReviewsHadoop.DataDividerByUser$DataDividerReducer</value>
</property>
<property>
<name>mapred.map.tasks</name>
<value>1</value>
</property>
<property>
<name>mapred.input.dir</name>
<value>/user/hduser/examples/input-data/text</value>
</property>
<property>
<name>mapred.output.dir</name>
<value>/user/hduser/examples/output-data/map-reduce</value>
</property>
</configuration>
</map-reduce>

最佳答案

我认为是有原因的(不过,在您在下面澄清我的问题之前,我将不删除先前的答案):

由于您已经在单个DataDividerByUser类中将mapper和reducer类创建为静态类,因此需要在工作流中将它们指定为:

    <property>
<name>mapreduce.map.class</name>
<value>MovieReviewsHadoop.DataDividerByUser$DataDividerMapper</value>
</property>
<property>
<name>mapreduce.reduce.class</name>
<value>MovieReviewsHadoop.DataDividerByUser$DataDividerReducer</value>
</property>

换句话说,您需要在基类和mapper / reducer类之间用 .替换 $

关于hadoop - 与 Action 相关的未知Hadoop作业。操作失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58201810/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com