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

hive 一次性命令的更多相关文章

  1. 分区表,桶表,外部表,以及hive一些命令行小工具

    hive中的表与hdfs中的文件通过metastore关联起来的.Hive的数据模型:内部表,分区表,外部表,桶表受控表(managed table):包括内部表,分区表,桶表 内部表: 我们删除表的 ...

  2. [Spark][Hive]Hive的命令行客户端启动:

    [Spark][Hive]Hive的命令行客户端启动: [training@localhost Desktop]$ chkconfig | grep hive hive-metastore 0:off ...

  3. Hive Shell 命令详解

    Hive服务介绍 Hive默认提供的cli(shell)服务,如果需要启动其他服务,那么需要service参数来启动其他服务,比如thrift服务.metastore服务等.可以通过命令hive -- ...

  4. Hive shell 命令

    Hive shell 命令. 连接 hive shell 直接输入 hive 1.显示表 hive> show tables; OK test Time taken: 0.17 seconds, ...

  5. 【原创】官方文档-hive 启动命令

    [一起学Hive]之十六-Hive的WEB页面接口-HWI Apache Hive 管网 hive metrics hive常用命令整理 Hive学习之HiveServer2服务端配置与启动 启动hi ...

  6. Hive 常用命令和语句

    示例数据库为 db_hive 1. 创建表 create-table.sql create table if not exists db_hive.tb_user ( id int, username ...

  7. 1.10-1.11 hive交互式命令讲解

    一.hive 交互式命令参数 #帮助 [root@hadoop-senior hive-0.13.1]# bin/hive -h Missing argument for option: h usag ...

  8. Hive之命令

    Hive之命令 说明:此博客只记录了一些常见的hql,create/select/insert/update/delete这些基础操作是没有记录的. 一.时间级 select day -- 时间 ,d ...

  9. Hive常用命令

    本位为转载,原地址为:http://www.cnblogs.com/BlueBreeze/p/4232421.html #创建新表 hive> CREATE TABLE t_hive (a in ...

随机推荐

  1. a data verification error occurred, file load failed

    1. 调试创龙DSP6748的时候,下载.out文件出现这个错误 2. 换了其他板子,还有其他仿真器也不行,最后发现是没加载GEL文件

  2. mariadb BINLOG_FORMAT = STATEMENT 异常

    当在mariadb中插入数据是报 InnoDB is limited to row-logging 异常: java.sql.SQLException: Cannot execute statemen ...

  3. Centos上搭建git服务

    1.安装Git $ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel $ yum ...

  4. JavaScript变态题目

    刚才发现的一些变态的 JavaScript 题目,做了一下,只对了一半,特此发到园子里,和友友们分享一下.这些题目都是针对 Ecmascript 第三版的,原题里面全部都是选择题,有备选答案,这里我把 ...

  5. POJ 3784 Running Median(动态维护中位数)

    Description For this problem, you will write a program that reads in a sequence of 32-bit signed int ...

  6. Alpha阶段中间产物——GUI Prototype、WBS及PSP

    作业地址:https://edu.cnblogs.com/campus/nenu/SWE2017FALL/homework/1224 内容: GUI Prototype 我的书架 我的书架→添加图书 ...

  7. HDU 5179 beautiful number 数位dp

    题目链接: hdu: http://acm.hdu.edu.cn/showproblem.php?pid=5179 bc(中文): http://bestcoder.hdu.edu.cn/contes ...

  8. 周总结web未完成的代码

    <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Con ...

  9. HTTP vs HTTPS

    参考博文:HTTP与HTTPS的区别 HTTP与HTTPS的区别 一.HTTP和HTTPS的基本概念和区别 HTTP: 是互联网上应用最为广泛的一种网络协议,是一个客户端和服务器端请求和应答的标准(T ...

  10. Rsyslog初步学习

    一.Rsyslog整体架构 Rsyslog消息流:输入模块——>预处理模块——>主队列——>过滤模块——>执行队列——>输出模块 1. 输入模块 输入模块是消息来源 2. ...