码迷,mamicode.com
首页 > 其他好文 > 详细

1.10-1.11 hive交互式命令讲解

时间:2019-04-19 16:00:48      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:silent   exec   sel   for   hadoop   server   padding   一个   and   

一、hive 交互式命令参数

#帮助
[root@hadoop-senior hive-0.13.1]# bin/hive -h
Missing argument for option: h
usage: hive
 -d,--define <key=value>          Variable subsitution to apply to hive
                                  commands. e.g. -d A=B or --define A=B
    --database <databasename>     Specify the database to use
 -e <quoted-query-string>         SQL from command line
 -f <filename>                    SQL from files
 -H,--help                        Print help information
 -h <hostname>                    connecting to Hive Server on remote host
    --hiveconf <property=value>   Use value for given property
    --hivevar <key=value>         Variable subsitution to apply to hive
                                  commands. e.g. --hivevar A=B
 -i <filename>                    Initialization SQL file
 -p <port>                        connecting to Hive Server on port number
 -S,--silent                      Silent mode in interactive shell
 -v,--verbose                     Verbose mode (echo executed SQL to the



#bin/hive -e    #交互式执行查询
使用:
[root@hadoop-senior hive-0.13.1]# bin/hive -e "select * from db_hive.student;"


#bin/hive -f    #SQL from files;sql语句保存在文件中,如xx.sql,使用文件执行SQL
使用l;
bin/hive -f /opt/datas/hivef.sql
 bin/hive -f /opt/datas/hivef.sql > /opt/datas/123.txt    #将结果写入文件中


#bin/hive -i    #后期再讲


二、hive 交互式命令参数

>quit/exit        #退出命令行,

>set key=value    #设置值

>set        

>!+Linux命令    #在hive中执行Linux的命令
hive (default)> !ls /opt/datas;
hivef.sql
student.txt

>dfs        #在hive中操作hdfs的命令

>query string    #其他很多的查询命令,

查看历史命令:

#在系统当前用的家目录下有一个“.hivehistory”的隐藏文件,存放着hive的历史命令

1.10-1.11 hive交互式命令讲解

标签:silent   exec   sel   for   hadoop   server   padding   一个   and   

原文地址:https://www.cnblogs.com/weiyiming007/p/10736322.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!