Workflow-Mapreduce Action

来源:互联网 发布:mac英英词典 编辑:程序博客网 时间:2024/06/05 18:44

本workflow位于oozie目录下新创建的一个oozie-apps文件夹下的mr-wc-wf文件夹中。

mr-wc-wf:

1、job.properties

2、lib文件夹(其中包含了一个wordcount程序的jar包)

3、workflow.xml

将整个oozie-apps文件夹上传到hdfs的对应用户目录下

然后运行程序

bin/oozie job -config oozie-apps/mr-wc-wf/job.properties -run


job.properies:

nameNode=hdfs://BPF:9000jobTracker=BPF:8032queueName=defaultoozie-appsRoot=user/bpf/oozie-appsDataRoot=user/bpf/oozie/datasoozie.wf.application.path=${nameNode}/${oozie-appsRoot}/mr-wc-wf/workflow.xmlinputDir=mr-wc-wf/inputoutputDir=mr-wc-wf/output

workflow.xml:

<workflow-app xmlns="uri:oozie:workflow:0.5" name="map-wc-wf">    <start to="mr-node-wc"/>    <action name="mr-node-wc">        <map-reduce>            <job-tracker>${jobTracker}</job-tracker>            <name-node>${nameNode}</name-node>            <prepare>                <delete path="${nameNode}/${DataRoot}/${outputDir}"/>            </prepare>            <configuration>              <property>                    <name>mapred.mapper.new-api</name>                    <value>true</value>                </property>                <property>                    <name>mapred.reducer.new-api</name>                    <value>true</value>                </property>                <property>                    <name>mapreduce.job.queuename</name>                    <value>${queueName}</value>                </property>                <property>                    <name>mapreduce.job.map.class</name>                    <value>com.bpf.hadoop.WordCount$TokenizerMapper</value>                </property>                <property>                    <name>mapreduce.job.reduce.class</name>                    <value>com.bpf.hadoop.WordCount$IntSumReducer</value>                </property>                <property>                    <name>mapreduce.map.output.key.class</name>                    <value>org.apache.hadoop.io.Text</value>                </property>                <property>                    <name>mapreduce.map.output.value.class</name>                    <value>org.apache.hadoop.io.IntWritable</value>                </property>                <property>                    <name>mapreduce.job.output.key.class</name>                    <value>org.apache.hadoop.io.Text</value>                </property>                <property>                    <name>mapreduce.job.output.value.class</name>                    <value>org.apache.hadoop.io.IntWritable</value>                </property>                                <property>                    <name>mapreduce.input.fileinputformat.inputdir</name>                    <value>${nameNode}/${DataRoot}/${inputDir}</value>                </property>                <property>                    <name>mapreduce.output.fileoutputformat.outputdir</name>                    <value>${nameNode}/${DataRoot}/${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>




原创粉丝点击