oozie使用

oozie  job  -oozie  http://master:11000/oozie  -config  /opt/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/share/doc/oozie-4.1.0+cdh5.7.2+282/examples/apps/*/job.properties  -run
1.所有流程做了一个统一的例子  
2.*:只需替换*文件夹路径
3.每次修改job.properties文件
4.配置文件在集群中的路径:/opt/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/share/doc/oozie-4.1.0+cdh5.7.2+282/examples/apps/map-reduce/job.properties

//杀死一个oozie进程



1.map-reduce:
oozie  job  -oozie  http://master:11000/oozie  -config  /opt/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/share/doc/oozie-4.1.0+cdh5.7.2+282/examples/apps/map-reduce/job.properties  -run
2.sqoop
oozie  job  -oozie  http://master:11000/oozie  -config  /opt/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/share/doc/oozie-4.1.0+cdh5.7.2+282/examples/apps/sqoop/job.properties  -run




oozie调度sqoop导入数据到oracle---->最近在使用sqooporacle中的数据导入到hbase中, 表中的数据每个小时导入一次,使用oozie定时促发。 

1.编辑coordinator.xml 
<coordinator-app name="cfg_check_formula-coord" frequency="${coord:hours(1)}" start="${start}" end="${end}" timezone="UTC"  
                 xmlns="uri:oozie:coordinator:0.2">  
    <controls>  
        <concurrency>1concurrency>  
    controls>  
  
    <action>  
        <workflow>  
            <app-path>${nameNode}/user/${coord:user()}/${tescommRoot}/apps/sqoop/cfg_check_formulaapp-path>  
        workflow>  
    action>  
coordinator-app>
2.编辑workflow.xml
<workflow-app xmlns="uri:oozie:workflow:0.2" name="sqoop-cfg_check_formula-wf">  
    <start to="sqoop-node"/>  
  
    <action name="sqoop-node">  
        <sqoop xmlns="uri:oozie:sqoop-action:0.2">  
            <job-tracker>${jobTracker}job-tracker>  
            <name-node>${nameNode}name-node>  
    
            <configuration>  
                <property>  
                    <name>mapred.job.queue.namename>  
                    <value>${queueName}value>  
                property> 
//重点配置sqoop导入数据 
            configuration>  
            <arg>importarg>  
            <arg>--connectarg>  
            <arg>jdbc:oracle:thin:@127.0.0.1:1523:TESTarg>  
            <arg>--usernamearg>  
            <arg>oraarg>  
            <arg>--passwordarg>  
            <arg>111arg>  
            <arg>--marg>  
            <arg>1arg>  
            <arg>--queryarg>
//表明需指明别名             
            <arg>SELECT ROWID, a.* FROM cfg_check_formula a WHERE $CONDITIONSarg>  
            <arg>--map-column-javaarg>  
            <arg>ROWID=Stringarg>  
            <arg>--hbase-tablearg>  
            <arg>cfg_check_formulaarg>  
            <arg>--hbase-row-keyarg>  
            <arg>ROWIDarg>  
            <arg>--column-familyarg>  
            <arg>f_cfg_check_formulaarg> 
             
        sqoop>  
        <ok to="end"/>  
        <error to="fail"/>  
    action>  
  
    <kill name="fail">  
        <message>Sqoop import cfg_check_formula failed, error message[${wf:errorMessage(wf:lastErrorNode())}]message>  
    kill>  
    <end name="end"/>  
workflow-app>  
3.编辑job.properties
nameNode=hdfs://master:8020  
jobTracker=master:8032  
queueName=default  
testRoot=test  
oozie.use.system.libpath=true  
oozie.coord.application.path=${nameNode}/user/${user.name}/${testRoot}/apps/sqoop/cfg_check_formula  
#start=2013-08-29T10:00Z  
#end=2013-08-29T12:00Z  
##注意时间格式
start=2013-09-04T11:00+0800  
end=2013-09-04T12:00+0800  
4.上述配置完后,在workflow目录下创建lib目录,把sqoop lib下的jar拷贝至这个目录下。这样我们就可以通过oozie定时启动这个导入任务
一、客户端命令

1.提交作业,作业进入PREP状态 
oozie job -oozie http://localhost:11000/oozie -config job.properties -submit   job: 14-20090525161321-oozie-joe
2.执行已提交的作业

oozie job -oozie  http://localhost:11000/oozie -start 14-20090525161321-oozie-joe       

3.直接运行作业       
oozie job -oozie http://localhost:11000/oozie -config job.properties -run       

4.挂起作业,挂起前状态(RUNNING , RUNNIINGWITHERROR or PREP状态)      
workflow job will be in SUSPENDED status.       

5.杀死作业       
oozie job -oozie http://localhost:11000/oozie -kill 14-20090525161321-oozie-joe      

6.改变作业参数,不能修改killed状态的作业       
oozie job -oozie http://localhost:11000/oozie -change 14-20090525161321-oozie-joe -value endtime=2011-12-01T05:00Z;concurrency=100;2011-10-01T05:00Z      

7.重新运行作业       
oozie job -oozie http://localhost:11000/oozie -config job.properties -rerun 14-20090525161321-oozie-joe 000000-130817230824019-oozie-ceny-W       
Rerunning a Coordinator Action or Multiple Actions        
oozie job -rerun  [-nocleanup] [-refresh] [-action 1, 3-4, 7-40] [-date 2009-01-01T01:00Z::2009-05-31T23:59Z, 2009-11-10T01:00Z, 2009-12-31T22:00Z] 

 (-action or -date is required to rerun.) 
Rerunning a Bundle Job        
oozie job -rerun  [-nocleanup] [-refresh] [-coordinator c1, c3, c4] [-date 2009-01-01T01:00Z::2009-05-31T23:59Z, 2009-11-10T01:00Z, 2009-12-31T22:00Z]   

(-coordinator or -date is required to rerun.if neither -coordinator nor -date is given, the exception will be thrown.)

8.检查作业状态       
oozie job -oozie http://localhost:11000/oozie -info 14-20090525161321-oozie-joe

oozie job -oozie http://localhost:11000/oozie -info 0000001-111219170928042-oozie-para-W@mr-node -verbose     

9.查看日志       
oozie job -oozie http://localhost:11000/oozie -log 14-20090525161321-oozie-joe      
oozie job -log  [-action 1, 3-4, 7-40] (-action is optional.)

10.检查xml文件是否合规       
oozie validate myApp/workflow.xml

11.提交pig作业       
oozie pig -oozie http://localhost:11000/oozie -file pigScriptFile -config job.properties -X -param_file params

12.提交MR作业       
oozie mapreduce -oozie http://localhost:11000/oozie -config job.properties

你可能感兴趣的:(oozie)