
[bigdata@hadoop002 executor]$ bin/azkaban-executor-start.sh
[bigdata@hadoop002 server]$ bin/azkaban-web-start.sh
注意:
先执行executor,再执行web,避免Web Server会因为找不到执行器启动失败。



[bigdata@hadoop002 azkaban]$ mkdir jobs
[bigdata@hadoop002 jobs]$ vim first.job
// 内容
type=command
command=echo 'this is my first job'[bigdata@hadoop002 jobs]$ zip first.zip first.job
注意: 目前,Azkaban上传的工作流文件只支持xxx.zip文件。zip应包含xxx.job运行作业所需的文件和任何文件(文件名后缀必须以.job结尾,否则无法识别)。作业名称在项目中必须是唯一的。
① 创建project

②上传zip包







第一个job:start.job
[bigdata@hadoop002 jobs]$ vim start.job
#start.job
type=command
command=touch /opt/module/buwenbuhuo.txt第二个job:step1.job依赖start.job
[bigdata@hadoop002 jobs]$ vim step1.job
#step1.job
type=command
dependencies=start
command=echo "this is step1 job"第三个job:step2.job依赖start.job
[bigdata@hadoop002 jobs]$ vim step2.job
#step2.job
type=command
dependencies=start
command=echo "this is step2 job"第四个job:finish.job依赖step1.job和step2.job
[bigdata@hadoop002 jobs]$ vim finish.job
#finish.job
type=command
dependencies=step1,step2
command=echo "this is finish job"[bigdata@hadoop002 jobs]$ zip jobs.zip start.job step1.job step2.job finish.job




使用Azkaban调度java程序

package com.buwenbuhuo.azkaban;
import java.io.FileOutputStream;
import java.io.IOException;
/**
 * @author 卜温不火
 * @create 2020-05-19 12:40
 * com.buwenbuhuo.azkaban - the name of the target package where the new class or interface will be created.
 * azkaban0519 - the name of the current project.
 */
public class JavaJob {
    public static void main(String[] args) throws IOException {
        // 根据需求编写具体代码
        FileOutputStream fos = null;
        try {
           fos =  new FileOutputStream("/opt/module/azkaban_0519.txt");
           fos.write("this is a java job".getBytes());
        }catch (IOException e){
            e.printStackTrace();
        }finally {
           try{
               fos.close();
           } catch (IOException e){
               e.printStackTrace();
           }
        }
    }
}
type=javaprocess
java.class=com.buwenbuhuo.azkaban.JavaJob
classpath=./azkaban-0519-1.0-SNAPSHOT.jar



[bigdata@hadoop002 jobs]$ cd ..
[bigdata@hadoop002 azkaban]$ cd ..
[bigdata@hadoop002 module]$ ll

#hdfs job
type=command
command=/opt/module/hadoop-2.7.2/bin/hadoop fs -mkdir /azkaban// 先启动hdfs和yarn
[bigdata@hadoop002 module]$ start-dfs.sh 
[bigdata@hadoop003 module]$ start-yarn.sh 


mapreduce任务依然可以使用azkaban进行调度
#mapreduce job
type=command
command=/opt/module/hadoop-2.7.2/bin/hadoop jar /opt/module/hadoop-2.7.2/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar wordcount /input /output_0519




本次的分享就到这里了