zoukankan      html  css  js  c++  java
  • hive 一次性命令

    1、用hive查询,而不进入hive cli,查询后的值可以保存到文件中

    #使用参数-e
    [hadoop@bigdata-senior01 ~]$ hive -e "select * from busdata.weather_count"
    
    OK
    1990    900
    1991    887
    1992    909
    1993    923
    1994    873
    1995    866
    1996    987
    1997    961
    1998    853
    1999    914
    2000    927
    Time taken: 3.221 seconds, Fetched: 11 row(s)
    #加上静默开关-S,过滤ok和tim taken
    [hadoop@bigdata-senior01 ~]$ hive -S -e "select * from busdata.weather_count"
    1990    900
    1991    887
    1992    909
    1993    923
    1994    873
    1995    866
    1996    987
    1997    961
    1998    853
    1999    914
    2000    927
    #结果导入到本地文件中
    [hadoop@bigdata-senior01 ~]$ hive -S -e "select * from busdata.weather_count" > weather_max.txt

    2、查找某个配置属性

    [hadoop@bigdata-senior01 ~]$ hive -S -e "set" | grep warehouse
    hive.metastore.warehouse.dir=/hive/warehouse

    3、执行外部脚本

    [hadoop@bigdata-senior01 ~]$ cat weather_query.hql
    select * from busdata.weather_count;
    select * from busdata.weather_max;
    
    [hadoop@bigdata-senior01 ~]$ hive -f /home/hadoop/weather_query.hql
    #静默执行,然后结果导入文件
    [hadoop@bigdata-senior01 ~]$ hive -S -f /home/hadoop/weather_query.hql >weather_mix.txt
  • 相关阅读:
    Nginx +keepalived
    iptables
    编译安装HTTPD 2.4.9版本
    Apache+lvs高可用+keepalive(主从+双主模型)
    LVS-HA
    corosync+pacemaker实现高可用(HA)集群
    NTP
    私人定制自己的linux小系统
    大数据处理-bitmap是个神马东西
    CSS3制作苹果风格键盘
  • 原文地址:https://www.cnblogs.com/asker009/p/10520313.html
Copyright © 2011-2022 走看看