国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

oozie常用語句

2024-07-21 02:51:49
字體:
供稿:網(wǎng)友

一.oozie的介紹:oozie可以被稱為一個調(diào)度系統(tǒng),具體可參照此篇博文:http://shiyanjun.cn/archives/684.html 以上這篇博文將oozie的功能和使用方法介紹的很詳細(xì) 二.oozie執(zhí)行后續(xù)監(jiān)控:可以將oozie的執(zhí)行結(jié)果寫入MySQL數(shù)據(jù)表中,通過本地的sh mysql.sh可以查看oozie的執(zhí)行情況: 1.執(zhí)行時長統(tǒng)計:

select tp.app_name ,ta.id ,(unix_timestamp(tb.end_time) - unix_timestamp(tb.created_time))/60 long_minutes ,date_format(adddate(date(ta.nominal_time),interval -1 day),'%Y%m%d') data_datefrom ( select * from COORD_JOBS ---oozie job的報表 where status='RUNNING' -- and app_name like 'ods%') tp inner join ( SELECT * FROM COORD_ACTIONS ---oozie action的list報表) ta on tp.id = ta.job_id AND tp.last_action_number=ta.action_number inner join ( select * from WF_ACTIONS --oozie每個action執(zhí)行時間報表 where id like '%hive%') tb on ta.external_id = tb.wf_idorder by long_minutes desc LIMIT 50;

上述代碼可用于查看執(zhí)行時長較長的任務(wù)名稱,便于優(yōu)化代碼。 2.用于檢查任務(wù)狀態(tài)

select -- ta.id, concat('oozie job -rerun ',tb.id,' -action ',ta.action_number) as cmd ,tb.app_name,ta.status from (select * from oozie.COORD_ACTIONS where status not in ('SUCCEEDED') ) ta inner join ( SELECT * FROM COORD_JOBS where (app_name like '%fact%' or app_name like '%rpt%' or app_name like 'dim_%' or app_name like 'ods%' or app_name like 'dw%') and status = 'RUNNING' ) tb on ta.job_id = tb.id -- where ta.status not in ('WAITING','READY')order by status ,app_name;

3.查指定任務(wù),用于獲得job名以及包含多少action

SELECT app_name,concat('oozie job -rerun ',id,' -action ',last_action_number),status as rerun FROM COORD_JOBS where (app_name like '%yezhu%') and status = 'RUNNING'

4.當(dāng)需要重刷歷史數(shù)據(jù)時,需要rerun多天action時,可用以下方法:

update coord_jobs set concurrency=3 ---并發(fā)的數(shù)量,應(yīng)考慮集群難度,不要太高 where id in ( '0402926-161231135848541-oozie-bigd-C' ); commit ;

5.oozie中job不能重復(fù),需要檢查是否多啟動job時,用以下方法:

SELECT app_name,count(1) cnt FROM COORD_JOBS where status = 'RUNNING' group by app_name having cnt >1 或者 SELECT app_name,count(distinct id) cnt FROM COORD_JOBS where (app_name like '%fact%' or app_name like '%rpt%' or app_name like 'dim_%' or app_name like 'ods%' or app_name like 'dw%' ) and status = 'RUNNING' group by app_name having cnt >1 ;

6.如果想更改某些action的狀態(tài),可用以下方法:

update oozie.COORD_ACTIONS set status='SUCCEEDED'where id in ( '0047657-160714171251022-oozie-bigd-C@75'---action名字,'0047657-160714171251022-oozie-bigd-C@73','0047657-160714171251022-oozie-bigd-C@74','0047657-160714171251022-oozie-bigd-C@72');commit ;

如果看過oozie配置文檔就會發(fā)現(xiàn),oozie需要配置三個文件:job.PRoperties,coordinator.xml,workflow.xml 此外應(yīng)該還有一個需要定時執(zhí)行的文件,假設(shè)文件名為test.sql ,這四個文件調(diào)試好后,放在本地目錄中,需要上傳到hadoop文件目錄中:假設(shè)本地目錄是/home/datadev/oozie_jobs/rpt/test(文件夾名字最好和sql文件一致)目錄中的文件分別是: job.properties,coordinator.xml,workflow.xml,test.sql 則hadoop上應(yīng)建一個和本地相同名稱的文件夾

在hadoop上創(chuàng)建文件夾 hadoop fs -mkdir oozie/rpt/testgrep 'rpt--' *2.hadoop dfs -put -f * oozie/rpt/test --全部傳過去如果重復(fù)覆蓋3. hadoop fs -put -f job.properties oozie/rpt/test/ --只傳job.properties這一個文件4. hadoop fs -ls oozie/rpt/test/ --查看文件夾內(nèi)容5. hadoop fs -ls oozie/rpt/test/test.sql --查看文件內(nèi)容

oozie常見命令操作:

1、測試任務(wù) oozie job -config job.properties -dryrun 2、正式提交運行一個任務(wù) oozie job -config job.properties -run 3、殺死一個任務(wù) oozie job -kill job_id 4、殺死一個action oozie job -kill job_id -action action_number 5、重跑一個action oozie job -rerun job_id -action action_number 6、更新coordinator oozie job -update job_id

有時候更新完代碼后用update不管用,只能把jobkill 了重新跑。


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 周至县| 蛟河市| 辰溪县| 高平市| 泸定县| 湖州市| 长汀县| 上林县| 定兴县| 南部县| 文成县| 体育| 株洲市| 友谊县| 临泽县| 长垣县| 三都| 安乡县| 平塘县| 沂水县| 宁远县| 孙吴县| 西乌珠穆沁旗| 上蔡县| 丹棱县| 睢宁县| 卓尼县| 象州县| 江山市| 西安市| 铜山县| 南华县| 大英县| 定结县| 延津县| 潮州市| 连平县| 阳春市| 黄冈市| 海城市| 汾西县|