Linux安装CDH调度工具Azkaban

小柒博客 Azkaban评论58.5K4字数 5539阅读18分27秒阅读模式

一、Azkaban 简介

Azkaban是由Linkedin开源的一个批量工作流任务调度器。用于在一个工作流内以一个特定的顺序运行一组工作和流程。Azkaban定义了一种KV文件格式来建立任务之间的依赖关系,并提供一个易于使用的web用户界面维护和跟踪你的工作流。

二、安装准备工作

系统环境:CentOS Linux release 7.9.2009 (Core)

执行服务器:azkaban-executor-server-2.5.0.tar.gz

下载地址:https://s3.amazonaws.com/azkaban2/azkaban2/2.5.0/azkaban-executor-server-2.5.0.tar.gz

服务器:azkaban-web-server-2.5.0.tar.gz

下载地址:https://s3.amazonaws.com/azkaban2/azkaban2/2.5.0/azkaban-web-server-2.5.0.tar.gz

执行的sql脚本:azkaban-sql-script-2.5.0.tar.gz

下载地址:https://s3.amazonaws.com/azkaban2/azkaban2/2.5.0/azkaban-sql-script-2.5.0.tar.gz

三、安装Mysql

1、安装Mysql

注:目前azkaban只支持Mysql,需安装Mysql服务器。

[root@localhost ~]# yum -y install mariadb mariadb-server mariadb-devel

[root@localhost ~]# systemctl start mariadb

[root@localhost ~]# systemctl enable mariadb

2、创建用户及授权

[root@localhost ~]# mysql

MariaDB [(none)]> create database azkaban;

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on azkaban.* to azkaban@'localhost' identified by '123456';

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.00 sec)

3、导入SQL文件

[root@localhost ~]# wget https://s3.amazonaws.com/azkaban2/azkaban2/2.5.0/azkaban-sql-script-2.5.0.tar.gz

[root@localhost ~]# tar xf azkaban-sql-script-2.5.0.tar.gz -C /usr/local

[root@localhost ~]# mysql

MariaDB [(none)]> use azkaban;

Database changed

MariaDB [azkaban]> source /usr/local/azkaban-2.5.0/create-all-sql-2.5.0.sql;

四、安装Azkaban-web

1、生成SSL证书

# 密码均设为:azkaban,其他信息随意填写,生成的keystore文件复制到azkaban-web-2.5.0目录下

[root@localhost ~]# keytool -keystore keystore -alias jetty -genkey -keyalg RSA

[root@localhost ~]# mv keystore /usr/local/azkaban-web-2.5.0

2、配置时区

[root@localhost ~]# timedatectl set-timezone Asia/Shanghai

3、下载Azkaban-web软件包

[root@localhost ~]# wget https://s3.amazonaws.com/azkaban2/azkaban2/2.5.0/azkaban-web-server-2.5.0.tar.gz

[root@localhost ~]# tar xf azkaban-web-server-2.5.0.tar.gz -C /usr/local/

4、配置azkaban.properties

[root@localhost ~]# cd /usr/local/azkaban-web-2.5.0/conf/

# 将所有路径都配置为绝对路径,否则会有各种找不到文件的错误

# 配置内容如下

#Azkaban Personalization Settings
azkaban.name=Azkaban
azkaban.label=My Local Azkaban
azkaban.color=#FF3601
azkaban.default.servlet.path=/index
web.resource.dir=/usr/local/azkaban-web-2.5.0/web/
default.timezone.id=Asia/Shanghai

#Azkaban UserManager class
user.manager.class=azkaban.user.XmlUserManager
user.manager.xml.file=/usr/local/azkaban-web-2.5.0/conf/azkaban-users.xml

#Loader for projects
executor.global.properties=/usr/local/azkaban-web-2.5.0/conf/global.properties
azkaban.project.dir=projects

database.type=mysql
mysql.port=3306
mysql.host=localhost
mysql.database=azkaban
mysql.user=azkaban
mysql.password=123456
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=/usr/local/azkaban-web-2.5.0/keystore
jetty.password=azkaban
jetty.keypassword=azkaban
jetty.truststore=/usr/local/azkaban-web-2.5.0/keystore
jetty.trustpassword=azkaban

# 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

5、配置管理员用户

[root@localhost conf]# vim azkaban-users.xml

# 配置内容如下

<azkaban-users>
	<user username="azkaban" password="azkaban" roles="admin" groups="azkaban" />
	<user username="metrics" password="metrics" roles="metrics"/>
	<user username="admin" password="admin" roles="admin,metrics" />	
	<role name="admin" permissions="ADMIN" />
	<role name="metrics" permissions="METRICS"/>
</azkaban-users>

6、启动Azkaban-web

[root@localhost conf]# mkdir ../logs

[root@localhost conf]# cd ../logs/

[root@localhost logs]# ../bin/azkaban-web-start.sh >/dev/null 2>&1

# 关闭Azkaban-web

[root@localhost logs]# ../bin/azkaban-web-shutdown.sh

7、访问Azkaban-web

1)浏览器输入https://172.168.1.156:8443/,如下图所示

# 注意:172.168.1.156为服务器IP地址

2)输入用户名和密码,均为admin

3)登录成功界面,如下图所示

五、安装Azkaban-exec

1、下载Azkaban-executor-server软件包

[root@localhost ~]# wget https://s3.amazonaws.com/azkaban2/azkaban2/2.5.0/azkaban-executor-server-2.5.0.tar.gz

[root@localhost ~]# tar xf azkaban-executor-server-2.5.0.tar.gz -C /usr/local

2、配置azkaban.properties

[root@localhost ~]# cd /usr/local/azkaban-executor-2.5.0/conf

[root@localhost conf]# vim azkaban.properties

# 配置内容如下

#Azkaban
default.timezone.id=Asia/Shanghai

# Azkaban JobTypes Plugins
azkaban.jobtype.plugin.dir=plugins/jobtypes

#Loader for projects
executor.global.properties=/usr/local/azkaban-executor-2.5.0/conf/global.properties
azkaban.project.dir=projects

database.type=mysql
mysql.port=3306
mysql.host=localhost
mysql.database=azkaban
mysql.user=azkaban
mysql.password=123456
mysql.numconnections=100

# Azkaban Executor settings
executor.maxThreads=50
executor.port=12321
executor.flow.threads=30

3、启动Azkaban-exec

[root@localhost conf]# mkdir ../logs

[root@localhost conf]# cd ../logs/

[root@localhost logs]# ../bin/azkaban-executor-start.sh >/dev/null 2>&1

# 关闭Azkaban-exec

[root@localhost logs]# /usr/local/azkaban-executor-2.5.0/bin/azkaban-executor-shutdown.sh

六、Azkaban实战

Azkaba内置的任务类型支持command、java

1、创建test.job描述文件

[root@localhost ~]# vim test.job

type=command
command=echo 'hello'

2、将job资源文件打包成zip文件,传到windows电脑上,后面需要上传文件。

[root@localhost ~]# zip test.zip test.job

[root@localhost ~]# sz test.zip

3、创建工程

# 登录Azkaban-web页面,如下图

4、上传刚才打包好的zip文件

至此,Azkaban-web已经搭建完毕。

七、常见错误

1、azkaban-users.xml找不到

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

解决:配置文件azkaban.properties里user.manager.xml.file改为绝对路径

2、Keystore找不到

java.io.FileNotFoundException: /usr/local/azkaban-web-2.5.0/bin/keystore (No such file or directory)

解决:复制keystore文件到bin目录下

3、插件地址不存在

ERROR [AzkabanWebServer] [Azkaban] plugin path plugins/triggers doesn't exist!

解决:暂不需要更改

4、网页登陆显示不正常

解决:修改web.resource.dir为绝对路径web.resource.dir=/usr/local/azkaban-web-2.5.0/web/

解决:使用安全连接https://172.168.1.156:8443

5、网页提示不信任

解决:添加例外

若文章图片、下载链接等信息出错,请在评论区留言反馈,博主将第一时间更新!如本文“对您有用”,欢迎随意打赏,谢谢!

继续阅读
Wechat
微信扫一扫,加我!
weinxin
微信公众号
微信扫一扫,关注我!
weinxin
小柒博客
  • 本文由 小柒博客 发表于 2021年1月14日14:55:23
  • 声明:本站所有文章,如无特殊说明或标注,本站文章均为原创。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。转载请务必保留本文链接:https://www.yangxingzhen.com/7837.html
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

拖动滑块以完成验证