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>1</concurrency>  
    </controls>  
  
    <action>  
        <workflow>  
            <app-path>${nameNode}/user/${coord:user()}/${tescommRoot}/apps/sqoop/cfg_check_formula</app-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>  
  <!--      <prepare>  
                <delete path="${nameNode}/user/${wf:user()}/${examplesRoot}/output-data/sqoop"/>  
                <mkdir path="${nameNode}/user/${wf:user()}/${examplesRoot}/output-data"/>  
            </prepare>  
  -->  
            <configuration>  
                <property>  
                    <name>mapred.job.queue.name</name>  
                    <value>${queueName}</value>  
                </property> 
//重點配置sqoop導入數據 
            </configuration>  
            <arg>import</arg>  
            <arg>--connect</arg>  
            <arg>jdbc:oracle:thin:@127.0.0.1:1523:TEST</arg>  
            <arg>--username</arg>  
            <arg>ora</arg>  
            <arg>--password</arg>  
            <arg>111</arg>  
            <arg>--m</arg>  
            <arg>1</arg>  
            <arg>--query</arg>
//表明需指明別名             
            <arg>SELECT ROWID, a.* FROM cfg_check_formula a WHERE $CONDITIONS</arg>  
            <arg>--map-column-java</arg>  
            <arg>ROWID=String</arg>  
            <arg>--hbase-table</arg>  
            <arg>cfg_check_formula</arg>  
            <arg>--hbase-row-key</arg>  
            <arg>ROWID</arg>  
            <arg>--column-family</arg>  
            <arg>f_cfg_check_formula</arg> 
             
        </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 <coord_Job_id> [-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 <bundle_Job_id> [-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 <coord_job_id> [-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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章