1. 程式人生 > >12_Azkaban案例實踐5_Command操作Hive腳本任務

12_Azkaban案例實踐5_Command操作Hive腳本任務

form cal col reat director bubuko image 圖片 lec

HIVE腳本任務

  hadoop fs -mkdir -p /aztest/hiveinput

  hadoop fs -put az.data /aztest/hiveinput/

  l 創建job描述文件和hive腳本

    Hive腳本: test.sql

use default;
drop table aztest;
create table aztest(id int,name string) 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.job
type=command
command=/usr/local/src/hive-1.2.1/bin/hive -f ‘test.sql‘

  2、將所有job資源文件打到一個zip包中

  技術分享圖片

  3、在azkaban的web管理界面創建工程並上傳zip包

  4、啟動job

  技術分享圖片

  技術分享圖片

12_Azkaban案例實踐5_Command操作Hive腳本任務