zoukankan      html  css  js  c++  java
  • azkaban 执行hive语句

    #hivef.job
    type=command
    command=hive -f test.sql

    #test.sql

    use default;
    drop table aztest;
    create table aztest(id int,name string) row format delimited fields terminated by ",";
    load data inpath '/home/lxl/b.txt' into table aztest;
    create table azres as select * from aztest;

     

    注意:因为azkaban是root用户安装的,所以在执行hivef.job文件时,里的command=su hdfs hive -f test.sql 需要写成这样,哈哈。
    如果是root用户需要在hdfs配置中去掉权限,不然执行不了。 在HDFS配置页面,找到属性dfs.permissions,取消勾选即可。
    1.先把把文件b.txt上传到hdfs服务器
         /root/device-report
         
         其中b.txt内容如下:
         2,bb
         3,cc
         7,yy
         9,pp
    2.修改文件权限
    3.放到hdfs用户目录下:
     
    4.切换到hdfs用户下:
         su hdfs
    5.把b.txt上传到hdfs服务器上:
    6.把test.sql,hivef打包zip文件
         
    7.azkaban中创建计划项目,如下:
    8.上传zip文件:
    9.添加执行计划:

     

    10.直接执行:

    11.执行后显示如下:

     

     
     

     

     
     
    12.看hive中是否有aztest和azres表
    看是否都有数据:
    完美,但是还是建议在hdfs上安装azkaban。
    以下是切换到hdfs用户下执行创建表等,以后请按这样的格式进行执行job。

    #hivef.job
    type=command
    command=sudo -u hdfs hive -f test.sql

     

    #test.sql

    use default;
    drop table aztest;
    create table aztest(id int,name string) row format delimited fields terminated by ",";
    load data inpath '/home/lxl/b.txt' into table aztest;
    create table azres as select * from aztest;

     

  • 相关阅读:
    编译原理是什么?有什么用?
    词频统计
    python基础综合练习
    熟悉常用的Linux操作
    大数据概述
    c语言程序的文法分析
    词法分析实验报告
    未完成的词法分析
    一名初学者对编译原理的看法
    使用Bootstrap.css 中IE下页面加载过慢问题
  • 原文地址:https://www.cnblogs.com/xiqing/p/9645806.html
Copyright © 2011-2022 走看看