Azkaban 简单入门
发布日期:2021-08-25 15:35:24 浏览次数:12 分类:技术文章

本文共 6785 字,大约阅读时间需要 22 分钟。

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

1. 安装

准备工作

azkaban-web-server-2.5.0.tar.gz azkaban-executor-server-2.5.0.tar.gz azkaban-sql-script-2.5.0.tar.gz

其中,azkaban-web-server-2.5.0.tar.gz是服务器,azkaban-executor-server-2.5.0.tar.gz是执行服务器,azkaban-sql-script-2.5.0.tar.gz是执行的sql脚本。

2. mysql创建表

分别把他们解压安装后。我们还需要在mysql中创建数据库,然后运行azkaban提供的sql脚本来创建azkaban所需要的表。

mysql -uroot -pmysql> create database azkaban;mysql> use azkaban;Database changedmysql> source /home/fantj/azkaban/azkaban-2.5.0/create-all-sql-2.5.0.sql;mysql> show tables;+------------------------+| Tables_in_azkaban      |+------------------------+| active_executing_flows || active_sla             || execution_flows        || execution_jobs         || execution_logs         || project_events         || project_files          || project_flows          || project_permissions    || project_properties     || project_versions       || projects               || properties             || schedules              || triggers               |+------------------------+15 rows in set (0.00 sec)复制代码

3. 创建SSL配置

1. 执行命令keytool -keystore keystore -alias jetty -genkey -keyalg RSA会在当前目录生成一个keystore证书文件,当然执行该命令需要你填写一些信息,比如你的姓名+工作单位等。按照提示填写即可。
2. 然后把 keystore 考贝到 azkaban web服务器bin目录中

4. 配置时区

[root@s166 azkaban]# tzselectPlease identify a location so that time zone rules can be set correctly.Please select a continent or ocean. 1) Africa 2) Americas 3) Antarctica 4) Arctic Ocean 5) Asia 6) Atlantic Ocean 7) Australia 8) Europe 9) Indian Ocean10) Pacific Ocean11) none - I want to specify the time zone using the Posix TZ format.#? 5Please select a country. 1) Afghanistan		  18) Israel		    35) Palestine 2) Armenia		  19) Japan		    36) Philippines 3) Azerbaijan		  20) Jordan		    37) Qatar 4) Bahrain		  21) Kazakhstan	    38) Russia 5) Bangladesh		  22) Korea (North)	    39) Saudi Arabia 6) Bhutan		  23) Korea (South)	    40) Singapore 7) Brunei		  24) Kuwait		    41) Sri Lanka 8) Cambodia		  25) Kyrgyzstan	    42) Syria 9) China		  26) Laos		    43) Taiwan10) Cyprus		  27) Lebanon		    44) Tajikistan11) East Timor		  28) Macau		    45) Thailand12) Georgia		  29) Malaysia		    46) Turkmenistan13) Hong Kong		  30) Mongolia		    47) United Arab Emirates14) India		  31) Myanmar (Burma)	    48) Uzbekistan15) Indonesia		  32) Nepal		    49) Vietnam16) Iran		  33) Oman		    50) Yemen17) Iraq		  34) Pakistan#? 9Please select one of the following time zone regions.1) Beijing Time2) Xinjiang Time#? 1The following information has been given:	China	Beijing TimeTherefore TZ='Asia/Shanghai' will be used.Local time is now:	Sat Jul 28 18:29:58 CST 2018.Universal Time is now:	Sat Jul 28 10:29:58 UTC 2018.Is the above information OK?1) Yes2) No#? 1You can make this change permanent for yourself by appending the line	TZ='Asia/Shanghai'; export TZto the file '.profile' in your home directory; then log out and log in again.Here is that TZ value again, this time on standard output so that youcan use the /usr/bin/tzselect command in shell scripts:Asia/Shanghai复制代码

这个配置需要给集群的每个主机设置,因为任务调度离不开准确的时间。我们也可以直接把相关文件拷贝到别的主机作覆盖。

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime复制代码
[root@s166 azkaban]# scp /usr/share/zoneinfo/Asia/Shanghai  root@s168:/etc/localtimeShanghai                                                                                              100%  388   500.8KB/s   00:00    [root@s166 azkaban]# scp /usr/share/zoneinfo/Asia/Shanghai  root@s169:/etc/localtimeShanghai   复制代码

5. 修改配置

5.1 修改服务端配置
5.1.1 /webserver/conf目录下的azkaban.properties(我之前将服务端的解压文件改名为webserver)
#Azkaban Personalization Settingsazkaban.name=Testazkaban.label=My Local Azkabanazkaban.color=#FF3601azkaban.default.servlet.path=/indexweb.resource.dir=web/default.timezone.id=Asia/Shanghai#Azkaban UserManager classuser.manager.class=azkaban.user.XmlUserManageruser.manager.xml.file=conf/azkaban-users.xml#Loader for projectsexecutor.global.properties=conf/global.propertiesazkaban.project.dir=projectsdatabase.type=mysqlmysql.port=3306mysql.host=localhostmysql.database=azkabanmysql.user=rootmysql.password=rootmysql.numconnections=100# Velocity dev modevelocity.dev.mode=false# Azkaban Jetty server properties.jetty.maxThreads=25jetty.ssl.port=8443jetty.port=8081jetty.keystore=keystorejetty.password=jiaorootjetty.keypassword=jiaorootjetty.truststore=keystorejetty.trustpassword=jiaoroot# Azkaban Executor settingsexecutor.port=12321# mail settingsmail.sender=844072586@qq.commail.host=smtp.qq.comjob.failure.email=job.success.email=lockdown.create.projects=falsecache.directory=cache复制代码

主要修改时区+mysql配置+SSL密码和文件路径+邮箱配置。不贴注释了,一看就懂。

5.1.2. 修改/conf/目录下的azkaban-users.xml
复制代码
5.2 执行服务器配置

修改/executor/conf目录下的azkaban.properties

#Azkabandefault.timezone.id=Asia/Shanghai# Azkaban JobTypes Pluginsazkaban.jobtype.plugin.dir=plugins/jobtypes#Loader for projectsexecutor.global.properties=conf/global.propertiesazkaban.project.dir=projectsdatabase.type=mysqlmysql.port=3306mysql.host=localhostmysql.database=azkabanmysql.user=rootmysql.password=rootmysql.numconnections=100# Azkaban Executor settingsexecutor.maxThreads=50executor.port=12321executor.flow.threads=30复制代码

6. 执行

6.1 启动web服务器

webserver/bin目录下,执行[root@s166 webserver]# nohup bin/azkaban-web-start.sh 1>/tmp/azstd.out 2>/tmp/azerr.out &启动服务。

小技巧:先别记着用nohup执行,不然报错不能够及时的反馈,应该在尝试执行通过后再去尝试用nohup来执行。[root@s166 executor]# bin/azkaban-executor-start.sh

我大概见到的一些报错是:

  1. /bin/目录下没有keystore文件------需要把它复制到bin下
  2. 找不到各种配置文件----- 我在配置文件中将这些文件配置成绝对路径。
6.2 启动执行服务器

/executor/bin/目录下执行[root@s166 webserver]# bin/azkaban-web-start.sh

6.3 浏览器访问https://s166:8443/

如果你看到这样的画面,证明你错了,没有在根目录下执行,而是习惯性的在bin目录下执行启动文件,所以它的很多css都加载不到。

用设置的账号密码登录。

7. Azkaban实战

7.1 单一job示例
  1. 创建job描述文件
vim command.job#command.jobtype=command                                                    command=echo fantj666复制代码
  1. 将job资源文件打包成zip文件 zip command.job

  2. 通过azkaban的web管理平台创建project并上传job压缩包 首先创建project

7.2 多job工作流flow
  1. 创建有依赖关系的多个job描述 第一个job:foo.job
# foo.jobtype=commandcommand=echo foo复制代码

第二个job:bar.job依赖foo.job

# bar.jobtype=commanddependencies=foocommand=echo bar复制代码
  1. 将所有job资源文件打到一个zip包中
  2. 上传zip包并启动
  3. 查看job log
7.3 操作hadoop
  1. vim fs.job
# fs.jobtype=commandcommand=/home/fantj/hadoop/bin/hadoop fs -lsr /复制代码
  1. 打包成zip上传
  2. 启动job并查看lob
7.4 操作hive

hive脚本test.sql

use default;drop table aztest;create table aztest(id int,name string,age int) 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.jobtype=commandcommand=/home/fantj/hive/bin/hive -f 'test.sql'复制代码

打zip包-上传-执行-查log

转载地址:https://blog.csdn.net/weixin_33858336/article/details/88006694 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:反射注解与动态代理综合使用
下一篇:SAP成都研究院CEC团队三巨头之一:M君的文章预告

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2024年04月11日 20时00分12秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

银河麒麟root用户登录方法 2019-04-27
银河麒麟在VMware虚拟机中如何更改窗口分辨率大小? 2019-04-27
数据库外键使用所造成的影响有哪些? 2019-04-27
每天自我提升的8个好习惯 2019-04-27
jquery.nicescroll参数说明 2019-04-27
windows查看指定的端口是否开放 2019-04-27
微信小程序开发(三)——IE盒子,Flex弹性布局,色子六面 2019-04-27
Python 技术篇-pip安装tar.gz格式的离线资源包 2019-04-27
windows 技术篇-将本地主机加入域的方法实例演示 2019-04-27
Python 图像处理篇-利用opencv库展示本地图片实例演示 2019-04-27
Python 图像处理篇-利用opencv库和numpy库读取包含中文路径下的本地图片实例演示 2019-04-27
oracle 数据回滚,恢复误删的数据,闪回表功能的使用 2019-04-27
mac 系统新功能体验-根据时间变化的动态桌面背景,看壁纸演绎风景大片中的日出与日落 2019-04-27
ADB的安装和使用教程,小米手机连接adb实例演示 2019-04-27
windows 关闭粘滞键-解决Microsoft Remote Desktop输入自动变为快捷键问题 2019-04-27
测试工具 - Postman接口测试入门使用手册,Postman如何进行数据关联、自动更新cookies、简单编程 2019-04-27
PyQt5 技术篇-调用字体对话框(QFontDialog)获取字体,控件设置字体。 2019-04-27
Python 技术篇-将python项目打包成exe独立运行程序,pyinstaller库打包python代码实例演示 2019-04-27
Geany 权限问题:"Error opening file ... : permission denied.",原因及解决办法。 2019-04-27
CSDN博客主页增加赞赏码收钱模块,高端大气上档次! 2019-04-27