azkaban使用小案例

一、hdfs的调度

1) 创建job描述文件

-- hdfs.sh
#!/bin/bash
/export/servers/hadoop-2.6.0-cdh5.14.0/bin/hadoop fs -mkdir /azaz666

-- fs.job
type=command
command=sh hdfs.sh


2)将以上两个文件打包成zip包

3)通过azkaban的web管理平台创建project并上传job压缩包

4)启动执行该job

二、mapreduce任务调度

mr任务依然可以使用command的job类型来执行

1)创建job文件 以及mr程序jar包

2)将所有job文件打包成zip

3)在azkaban的web管理界面创建工程并上传zip包

4)启动job

三、hive任务调度

1)创建job描述文件和hive脚本

        

Hive脚本内容: test.sql
use default;
drop table aztest;
create table aztest(id int,name string) row format delimited fields terminated by ',';
load data  inpath '/aztest/hiveinput' into table aztest;
create table azres as select * from aztest;
insert overwrite directory '/aztest/hiveoutput' select count(1) from aztest; 

Job描述文件内容:hivef.job
# hivef.job
type=command
command=/home/hadoop/apps/hive/bin/hive -f 'test.sql'

2)打包上传

原文地址:https://www.cnblogs.com/haojia/p/12386221.html