how to deploy and run oozie job?

psmith picture psmith · Jan 30, 2014 · Viewed 21k times · Source

I'm trying to do a simple job using oozie.
It will be a one simple Pig Action.

I have a file : FirstScript.pig containing:

dual = LOAD 'default.dual' USING org.apache.hcatalog.pig.HCatLoader();
store dual into 'dummy_file.txt' using PigStorage();

and a workflow.xml containing:

<workflow-app name="FirstWorkFlow" xmlns="uri:oozie:workflow:0.2">
    <start to="FirstJob"/> 
    <action name="FirstJob">
        <pig>
            <job-tracker>hadoop:50300</job-tracker>
            <name-node>hdfs://hadoop:8020</name-node>
            <script>/FirstScript.pig</script>
        </pig>
        <ok to="okjob"/>
        <error to="errorjob"/>
    </action>
    <ok name='okjob'>    
        <message>job OK, message[${wf:errorMessage()}]</message>
    </ok>    
    <error name='errorjob'>    
        <message>job error, error message[${wf:errorMessage()}]</message>
    </error>    
</workflow-app>

I have created structure :

FirstScript
|- lib
|---FirstScript.pig
|- workflow.xml

And what now? How do I deploy it and run with oozie?
Can anyone more experienced help?

Regards
Pawel

Answer

Viacheslav Rodionov picture Viacheslav Rodionov · Jan 30, 2014

I do it like this:

hadoop fs -put workflow.xml some_dir/ 
oozie job --oozie http://your_host:11000/oozie -config cluster_conf.xml -run

and my cluster_conf.xml looks like this (please check your ports first they depend on Hadoop distro):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configuration>
<property>
        <name>nameNode</name>
        <value>hdfs://my_nn:8020</value>
</property>
<property>
        <name>jobTracker</name>
        <value>my_jt:8050</value>
</property>
<property>
        <name>oozie.wf.application.path</name>
        <value>/user/my_user/some_dir/workflow.xml</value>
</property>
</configuration>