先启动Hadoop,hive,和 azkaban的两个进程:
打开网页:https://192.168.xx.xx:8443自己IP地址登录即可(admin:admin)
azkaban的运行执行脚本:
创建一个脚本a.job:
#command.job
type=command
command=echo "hello world
压缩为a.zip
在azkaban里面创建一个项目上传a.zip之后执行脚本变绿为正常。
然后把两个脚本压缩到一个包里;
上传azkaban执行:
创建oo.job脚本:
type=command
dependencies=ff
command= echo oo
创建ff.job的脚本:
#ff.job
type=command
command=echo ff
创建脚本:(在hdfs上创建一个input)
type=command
command=/usr/local/hadoop-2.7.3/bin/hadoop fs -mkdir /input
上传执行
用MapReduce处理数据:(需要一个jar包一起压缩上传azkaban)
创建脚本:
type=command
command=/usr/local/hadoop-2.7.3/bin/hadoop jar hadoop-mapreduce-examples-2.7.3.jar wordcount /input /output
准备jar包:(jar的位置在/usr/local/hadoop-2.7.3/share/hadoop/mapreduce)
hadoop-mapreduce-examples-2.7.3.jar
上传执行。
上传数据到hive:
创建一个脚本test.sql:
use default;
drop table aztest;
create table aztest(id int,name string) row format delimited fields terminated by ‘,’;
load data local inpath ‘/aztest/a.txt’ into table aztest;
create table azres as select * from aztest;
insert overwrite directory ‘/aztest/hiveoutput’ select count(1) from aztest;
创建一个脚本sql.job:
type=command
command=/usr/local/hive/bin/hive -f test.sql
把两个脚本压缩到一个包里上传azkaban执.