azkaban 简单demo
一. azkaban job简单配置
1. 目录结构
lib 目录下,为java的jar包
script 目录下,是shell脚本
sql 目录下,是hive sql脚本
2. 定义flow1信息
2.1. f1/az-hive-01.job1
2
3
4
5type: hive
azk.hive.action: execute.query
hive.script: sql/az-hive-01.sql
hiveconf.tb: test.action_log
hiveconf.rows: 5
hiveconf.xxx 指定需要传入sql的参数设置,sql文件内用${hiveconf:xx} 表示
2.2. f1/az-java-02.job1
2
3type=javaprocess
classpath=./lib/*
java.class=nick.weixx.az.run.MyJavaJob
java任务,指定运行的main class
2.3. f1/az-shell.job1
2
3type: command
command: sh ./script/az-comm-01.sh
dependencies: az-hive-01,az-java-02
执行shell 脚本,dependencies,表示需要等待,hive以及java任务执行成功后,执行。
2.4 f1/az-f1-end.job 定义flow1
2
3
4type: flow
flow.name: az-shell
failure.emails: weixinxing0226@gmail.com
success.emails: weixinxing0226@163.com
需要和 f1无依赖的最终任务名称(az-shell.job)一致
3. 定义flow2信息
3.1. f2/az-f2-1.job1
2type: command
command: echo "i' im flow 2."
3.2. f2/az-f2-end.job 定义flow2信息1
2
3
4type: flow
flow.name: az-f2-1
failure.emails: weixinxing0226@gmail.com
success.emails: weixinxing0226@163.com
flow.name 需要和flow2 的任务名称一致,既az-f2-1.job
3.3. az-end.job 定义最终任务信息1
2
3
4type: noop
dependencies: az-f1-end,az-f2-end
failure.emails: weixinxing0226@gmail.com
success.emails: weixinxing0226@163.comw
需要等待 flow1,flow2执行完毕
4. 打包运行
4.1. 打zip包,并上传
4.2. 设定任务
4.3. 设置定时执行,SLA报警
4.4. 运行结果
二. azkaban flow简单配置
1. 目录结构
lib 目录下,为java的jar包
script 目录下,是shell脚本
sql 目录下,是hive sql脚本
azkaban-demo-flow.project 定义执行flow的版本
azkaban-demo-flow.flow 定义工作流详细
2. 工作流设定1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36---
##成功或者失败的处理方式
config:
failure.emails: weixinxing0226@gmail.com
success.emails: weixinxing0226@163.com
##多任务依赖配置
nodes:
- name: azkaban-demo-flow
type: noop
dependsOn:
- hive-01
- shell-02
- java-03
- name: hive-01
type: hive
config:
azk.hive.action: execute.query
hive.script: azkaban-demo-flow/sql/az-hive-01.sql
hiveconf.tb: test.action_log
hiveconf.rows: 5
- name: shell-02
type: command
config:
command: sh ./azkaban-demo-flow/script/az-comm-01.sh
- name: java-03
type: javaprocess
config:
classpath: ./azkaban-demo-flow/lib/*
java.class: nick.weixx.az.run.MyJavaJob
dependsOn:
- hive-01
- shell-02
[demo地址] (git@github.com:nick-weixx/azkaban-demo.git)