在Oozie的workflow上面调用jar包
workflow.xml
<?xml version="1.0" encoding="UTF-8"?>
<workflow-app xmlns="uri:oozie:workflow:0.5" name="shell-wf">
<start to="shell-node"/>
<action name="shell-node">
<java>
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>mapreduce.job.queuename</name>
<value>${queueName}</value>
</property>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
<property>
<name>oozie.launcher.mapred.job.queue.name</name>
<value>${oozie_launcher_queue}</value>
</property>
</configuration>
<main-class>com.idata.Helloworld</main-class>
<capture-output/>
</java>
<ok to="end"/>
<error to="fail"/>
</action>
<kill name="fail">
<message>shell </message>
</kill>
<end name="end"/>
</workflow-app>
job.properties
nameNode=hdfs://namehaservice
jobTracker=namenode1:8032
queueName=default
oozie_launcher_queue=root.oozie
oozie.use.system.libpath=true
sdaRoot=sda
oozie.wf.application.path=${nameNode}/user/${user.name}/${sdaRoot}/shell
如果依赖外部包, 需要在项目文件下创建一个lib包,和项目文件一起put到HDFS上面去。
Paste_Image.png否则会出现ClassNotFoundException。
Paste_Image.pngOozie有个配置文件,会将job中的所有java文件引导到一个libpath下面:
Properties代码(可以不配置)
#use custom library
oozie.libpath=${namenode}/user/hadoop/share/lib
网友评论