azkabin的安装与调试

Git上下载源码:

地址:https://github.com/azkaban/azkaban

 

解压源码到/home:

unzip /home/azkaban-master.zip -d /home/

 

编译源码:

 

 

安装:

在安装咯hadoop、hive、sqoop等的机子上安装,好测试是否okay。先安装azkban web server:

解压azkaban-web-server-2.5.0.tar.gz 到azkaban目录中,并重新命名为webserver:

 

[root@hadoop01 home]# mkdir /usr/local/azkaban

[root@hadoop01 home]# tar -zxvf ./azkaban-web-server-2.5.0.tar.gz /usr/local/azkaban/

[root@hadoop01 home]# mv /usr/local/azkaban/azkaban-web-2.5.0 /usr/local/azkaban/webserver

 

Azkaban执行服务器的安装:

解压azkaban-executor-server-2.5.0.tar.gz到azkaban目录中并改名为executor

[root@hadoop01 home]# tar -zxvf /home/azkaban-executor-server-2.5.0.tar.gz -C /usr/local/azkaban/

[root@hadoop01 home]# mv /usr/local/azkaban/azkaban-executor-2.5.0/ /usr/local/azkaban/executor

 

 

Azkaban数据库脚本执行:

解压azkaban-sql-script-2.5.0.tar.gz并将解压目录下的create-all-sql-2.5.0.sql脚本导入到mysql中:

[root@hadoop01 home]# tar -zxvf /home/azkaban-sql-script-2.5.0.tar.gz

[root@hadoop01 home]# mysql -uroot -proot

mysql> create database azkaban;

Query OK, 1 row affected (0.01 sec)

mysql> use azkaban;

Database changed

mysql> source /home/azkaban-2.5.0/create-all-sql-2.5.0.sql;

 

创建ssl并配置:在webserver目录下

keytool -keystore keystore -alias jetty -genkey -keyalg RSA

命令如下:密码为azkaban

[root@hadoop01 azkaban]# keytool -keystore keystore -alias jetty -genkey -keyalg RSA

Enter keystore password:  

Re-enter new password:

What is your first and last name?

  [Unknown]:  

What is the name of your organizational unit?

  [Unknown]:  

What is the name of your organization?

  [Unknown]:  

What is the name of your City or Locality?

  [Unknown]:  

What is the name of your State or Province?

  [Unknown]:  

What is the two-letter country code for this unit?

  [Unknown]:  cz

Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=cz correct?

  [no]:  y

 

Enter key password for

(RETURN if same as keystore password):  

Re-enter new password:

 

完成上述工作后,将在当前目录生成 keystore 证书文件,将keystore 考贝到 azkaban web服务器根目录中的bin目录下.如:cp keystore azkaban/webserver。

[root@hadoop01 azkaban]# cp ./keystore /user/local/azkaban/webserver  原则上只要安装根目录有即可,可以不cp

 

 

配置文件

注:先配置好服务器节点上的时区

1、先生成时区配置文件Asia/Shanghai,用交互式命令 tzselect 即可

2、拷贝该时区文件,覆盖系统本地时区配置

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

 

3.配置文件的修改

azkaban web服务器配置

进入azkaban web服务器安装目录 conf目录

 

修改azkaban.properties文件

命令vi azkaban.properties

内容说明如下:

 

azkaban 执行器配置

进入执行器安装目录conf,修改azkaban.properties

vi azkaban.properties

内容说明如下:

#Azkaban Personalization Settings

azkaban.name=Test

azkaban.label=My Local Azkaban

azkaban.color=#FF3601

azkaban.default.servlet.path=/index

web.resource.dir=/opt/app/azkaban/webserver/web/

default.timezone.id=Asia/Shanghai

 

#Azkaban UserManager class

user.manager.class=azkaban.user.XmlUserManager

user.manager.xml.file=/opt/app/azkaban/webserver/conf/azkaban-users.xml

 

#Loader for projects

executor.global.properties=/opt/app/azkaban/executor/conf/global.properties

azkaban.project.dir=projects

 

database.type=mysql

mysql.port=3306

mysql.host=had01

mysql.database=azkaban

mysql.user=root

mysql.password=root

mysql.numconnections=100

 

# Velocity dev mode

velocity.dev.mode=false

 

# Azkaban Jetty server properties.

jetty.maxThreads=25

jetty.ssl.port=8443

jetty.port=8081

jetty.keystore=keystore

jetty.password=000000

jetty.keypassword=000000

jetty.truststore=keystore

jetty.trustpassword=000000

 

# Azkaban Executor settings

executor.port=12321

 

# mail settings

mail.sender=

mail.host=

job.failure.email=

job.success.email=

 

lockdown.create.projects=false

 

cache.directory=cache

 

用户配置:

进入azkaban web服务器conf目录,修改azkaban-users.xml

vi azkaban-users.xml 增加 管理员用户

 

修改executor下的azkaban.properties

#Azkaban

default.timezone.id=Asia/Shanghai

 

# Azkaban JobTypes Plugins

azkaban.jobtype.plugin.dir=plugins/jobtypes

 

#Loader for projects

executor.global.properties=/opt/app/azkaban/executor/conf/global.properties

azkaban.project.dir=projects

 

database.type=mysql

mysql.port=3306

mysql.host=had01

mysql.database=azkaban

mysql.user=root

mysql.password=root

mysql.numconnections=100

 

# Azkaban Executor settings

executor.maxThreads=50

executor.port=12321

executor.flow.threads=30

 

启动webserver:

[root@hadoop01 azkaban]# ./webserver/bin/azkaban-web-start.sh

1、启动报错:

Caused by: java.lang.IllegalArgumentException: User xml file conf/azkaban-users.xml doesn't exist.

将配置文件中的路径写成绝对路径。user.manager.xml.file=/usr/local/azkaban/webserver/conf/azkaban-users.xml

2、启动警告:

2018/12/13 17:37:50.320 +0800 WARN [log] [Azkaban] failed [email protected]:8443: java.io.FileNotFoundException: /usr/local/azkaban/keystore (No such file or directory)

重新copy keystore:cp /home/keystore /user/local/azkaban/  (原则是只需要放到azkaban的安装目录,不放启动会报错:/usr/local/azkaban/keystore (No such file or directory))

3、启动执行器报错:

Exception in thread "main" java.io.FileNotFoundException: conf/global.properties (No such file or directory)

4、将配置文件中写成绝对路径:

executor.global.properties=/usr/local/azkaban/executor/conf/global.properties

5、访问报错:

javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

检查将azkaban.properties的web配置成绝对目录:web.resource.dir=/usr/local/azkaban/webserver/web/

 

启动成功后登陆界面如下:

azkabin的安装与调试_第1张图片

输入配置的用户名和密码登录即可。

 

启动时可能web页面不能加载,点击页面的高级------继续加载即可

 

 

azkabin执行案例

1.一个job依赖于另一个job的执行

创建first.job文件

添加内容

type=command

command=echo "hello"

 

创建second.sh文件

添加如下内容

#!/bin/bash

echo "hello azkaban" >> /datas/data2.log

 

创建depends.job文件

添加如下的内容

type=command

dependencies=first

command=bash second.sh

打包zip

上传到azkabin运行

 

定时任务的执行

按execute按钮之后,点击下面的scheduce进行时间的设置即可

 

  1. AZKABIN执行sql语句

数据

student.uid     student.xi      student.fuid

1       1       1

1       1       3

2       1       10

2       2       11

1       1       4

1       2       5

1       2       6

2       1       7

2       1       8

2       1       9

1       1       2

2       2       12

2       2       13

 

 

书写sql文件

test.sql

use default;

select

*

from

(

select

uid,

xi,

mycon,

row_number() over(partition by uid,xi order by mycon desc) as myrow

from

(

select

uid,

xi,

count(fuid) over(partition by uid,xi) as mycon

from

student

) t1

) t2 where myrow<=1;

 

书写job文件

# hivef.job

type=command

command=/opt/app/hive-1.2.2/bin/hive -S -f 'test.sql'

你可能感兴趣的:(azkabin的安装与调试)