大数据全系列 教程
1869个小节阅读:468.1k
408考研
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
集群中提交任务,需要修改项目中的application.conf文件配置项:local.run="false"
。
并将项目打包MusicProject-1.0-SNAPSHOT-jar-with-dependencies.jar
,并上传到node3。
xxxxxxxxxx
[root@node3 ~]# cd music
[root@node3 music]# ls
MusicProject-1.0-SNAPSHOT-jar-with-dependencies.jar
确保在Hive中创建各个ODS层表及EDS层表
在安装azkaban的node1节点路径/root/music/下创建目录req5
xxxxxxxxxx
[root@node1 music]# mkdir req5
[root@node1 music]# cd req5/
编写导入数据脚本 extract_data.sh
对应商户营收日统计(业务四部分)
xxxxxxxxxx
[root@node1 req5]# cp ../req3/extract_usr_data.sh extract_data.sh
[root@node1 req5]# vim extract_data.sh
内容如下:
xxxxxxxxxx
currentDate=`date -d today +"%Y%m%d"`
if [ x"$1" = x ];then
echo "====azkaban中没有传入日期,使用今天日期==="
else
echo "===使用azkaban中传入的日期==="
currentDate=$1
fi
echo "分析数据的日期为:$currentDate"
ssh root@node3 > /root/music/logs/req5.log 2>&1 <<aabbcc
cd /root/music/sqoop/
sh ods_mysqltohive_to_ycak_usr_loc_d.sh $currentDate
sh ods_mysqltohive_to_ycak_cnsm_d.sh $currentDate
exit
aabbcc
echo "req5 job5 all done!"
编写脚本 eds_pre.sh
对应商户营收日统计(业务四部分)
xxxxxxxxxx
[root@node1 req5]# cp extract_data.sh eds_pre.sh
[root@node1 req5]# vim eds_pre.sh
内容如下:
xxxxxxxxxx
currentDate=`date -d today +"%Y%m%d"`
if [ x"$1" = x ];then
echo "====azkaban中没有传入日期,使用今天日期==="
else
echo "===使用azkaban中传入的日期==="
currentDate=$1
fi
echo "分析数据的日期为:$currentDate"
ssh root@node3 > /root/music/logs/req5.log 2>&1 <<aabbcc
cd /opt/spark-3.2.1/bin/
sh ./spark-submit --master yarn --class com.itbaizhan.scala.musicproject.eds.machine.GenerateTwMacLocD /root/music/MusicProject-1.0-SNAPSHOT-jar-with-dependencies.jar $currentDate
sh ./spark-submit --master yarn --class com.itbaizhan.scala.musicproject.eds.user.GenerateTwCnsmBriefD /root/music/MusicProject-1.0-SNAPSHOT-jar-with-dependencies.jar $currentDate
exit
aabbcc
echo "req5 job6 all done!"
编写脚本 eds_mac_stat.sh
对应商户营收日统计(业务四部分)
xxxxxxxxxx
[root@node1 req5]# cp eds_pre.sh eds_mac_stat.sh
[root@node1 req5]# vim eds_mac_stat.sh
内容如下:
xxxxxxxxxx
currentDate=`date -d today +"%Y%m%d"`
if [ x"$1" = x ];then
echo "====azkaban中没有传入日期,使用今天日期==="
else
echo "===使用azkaban中传入的日期==="
currentDate=$1
fi
echo "分析数据的日期为:$currentDate"
ssh root@node3 > /root/music/logs/req5.log 2>&1 <<aabbcc
cd /opt/spark-3.2.1/bin/
sh ./spark-submit --master yarn --class com.itbaizhan.scala.musicproject.eds.machine.GenerateTwMacStatD /root/music/MusicProject-1.0-SNAPSHOT-jar-with-dependencies.jar $currentDate
exit
aabbcc
echo "req5 job7 all done!"
编写脚本 tm_store_area.sh
对应商户营收日统计(业务四部分)
xxxxxxxxxx
[root@node1 req5]# cp eds_pre.sh tm_store_area.sh
[root@node1 req5]# vim tm_store_area.sh
内容如下:
xxxxxxxxxx
currentDate=`date -d today +"%Y%m%d"`
if [ x"$1" = x ];then
echo "====azkaban中没有传入日期,使用今天日期==="
else
echo "===使用azkaban中传入的日期==="
currentDate=$1
fi
echo "分析数据的日期为:$currentDate"
ssh root@node3 > /root/music/logs/req5.log 2>&1 <<aabbcc
cd /opt/spark-3.2.1/bin/
sh ./spark-submit --master yarn --class com.itbaizhan.scala.musicproject.dm.content.GenerateTmUsrMrchntStatD /root/music/MusicProject-1.0-SNAPSHOT-jar-with-dependencies.jar $currentDate
sh ./spark-submit --master yarn --class com.itbaizhan.scala.musicproject.eds.machine.GenerateTmMacRegionStatD /root/music/MusicProject-1.0-SNAPSHOT-jar-with-dependencies.jar $currentDate
exit
aabbcc
echo "req5 job8 all done!"
启动Azkaban 启动exec server
xxxxxxxxxx
[root@node1 azkaban-exec]# bin/start-exec.sh
[root@node2 azkaban-exec]# bin/start-exec.sh
[root@node3 azkaban-exec]# bin/start-exec.sh
扩展:关闭命令bin/shutdown-exec.sh
激活Executor
xxxxxxxxxx
{"status":"success"} #表示登录成功
【温馨提示】重启Azkaban Executor Server得重新激活
启动 web server
xxxxxxxxxx
[root@node2 azkaban-web]# bin/start-web.sh
测试访问http://node2:8081/,并用azkaban用户登录
编写azkaban 各个job组成任务流:
创建req5文件夹
在文件中创建azkaban.project
xxxxxxxxxx
azkaban-flow-version2.0
在文件中创建basic.flow
xxxxxxxxxx
nodes
name job1
type command
config
command sh /root/music/req2/extract_data.sh
name job2
type command
dependsOn
job1
config
command sh /root/music/req2/produce_tw_mac_baseinfo.sh $ mydate
name job3
type command
config
command sh /root/music/req3/extract_usr_data.sh $ mydate
name job4
type command
dependsOn
job3
config
command sh /root/music/req3/produce_tw_usr_baseinfo_d.sh $ mydate
name job5
type command
config
command sh /root/music/req5/extract_data.sh $ mydate
name job6
type command
dependsOn
job5
config
command sh /root/music/req5/eds_pre.sh $ mydate
name job7
type command
dependsOn
job2
job4
job6
config
command sh /root/music/req5/eds_mac_stat.sh $ mydate
name job8
type command
dependsOn
job7
config
command sh /root/music/req5/tm_store_area.sh $ mydate
压缩两个文件为req5.zip
azkaban创建项目,将req5.zip上传到项目,并配置参数
继续执行
检查相关表中的数据。