设为首页 加入收藏

TOP

Hadoop入门之azkaban的安装和使用
2019-01-27 00:40:42 】 浏览:58
Tags:Hadoop 入门 azkaban 安装 使用
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sqh201030412/article/details/78064071
1.azkaban的安装

2.azkaban的几种使用

2.1 使用小Demo

#command
type=command
command=sh/home/hadoop/shell/say_hello.sh

shell脚本

#!/bin/sh
format="+%Y%m%d_%H:%M:%S"
now_date=`date$format`
echo$now_datehelloworld!>>/home/hadoop/logs/say_hello.log

2.2 依赖任务的Demo

运行的Job

#command
type=command
command=sh/home/hadoop/shell/say_hello.shA

#command
type=command
command=sh/home/hadoop/shell/say_hello.shB


#command
type=command
command=sh/home/hadoop/shell/say_hello.shC
dependencies=A,B

执行的脚本

#!/bin/sh
user_name=$1
format="+%Y%m%d_%H:%M:%S"
now_date=`date$format`
echo$user_name$now_datehelloworld!>>/home/hadoop/logs/say_hello.log


2.3 操作HDFS的Demo

#command
type=command
command=hadoopfs-mkdir/azkaban_demo



2.4 操作Hive

在HDFS中创建目录/aztest/hiveinput
上传一个用户名文件如下:
1,xiaoming
2,xiaohong
3,xiaofang
5,xiaozhang

azkaban执行Job文件

#command
type=command
command=/home/hadoop/app/hive/bin/hive-f'/home/hadoop/sql/create_demo_table.sql'


create_demo_table.sql 文件内容

usedefault;
droptableaztest;
createtableaztest(idint,namestring)rowformatdelimitedfieldsterminatedby',';
loaddatainpath'/aztest/hiveinput'intotableaztest;
createtableazresasselect*fromaztest;
insertoverwritedirectory'/aztest/hiveoutput'selectcount(1)fromaztest;


查看执行结果:



】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Hadoop的split和block的区别和联系 下一篇hadoop查看和离开安全模式

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目