hive 使用方法--小工具(二)

1、小工具:

  • desc student; 描述表
  • desc extended student ; 查看表的详细信息(表的类型(内部表、外部表),表压缩否)
  • desc formatted student ; 格式化输出表信息
  • show create table student ;查看建表语句
  • show functions ; 查看hive中的函数
  • desc function upper; 描述函数
  • desc function extended upper; 描述方法具体使用方法
  • show tables; 查看所有的表
  • show databases; 查看所有的数据库
  • set hive.cli.print.header =true 设置参数,临时生效
  • minimal 是否跑mapreduce可配

2、帮助信息 (在shell中的help)

bin/hive -help 一个横杠

[root@yeemi01 hive-0.13.1-cdh5.3.6]# bin/hive -help
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
                                  console)

* bin/hive -e "select * from student" >> test.log  //加双引号,多条Hql用分号分割,可不用开启hive,在脚本执行;
* bin/hive -f hive.sql ; //执行文件,在文件中写入多个Hql。
* bin/hive --hiveconf    //添加参数,key-value对形式,对当前创库有效(相当于在配置文件中设置配置项);  --》一般用于测试,不会影响集群中其他的进程
*  bin/hive -d  default  指定默认进入default数据库
* 

bin/hive - -help (两个横杠,中间没空格)

[root@yeemi01 hive-0.13.1-cdh5.3.6]# bin/hive --help
Usage ./hive <parameters> --service serviceName <service parameters>
    Service List: beeline cli help hiveserver2 hiveserver hwi jar lineage metastore metatool orcfiledump rcfilecat schemaTool version 
Parameters parsed:
  --auxpath : Auxillary jars 
  --config : Hive configuration directory
  --service : Starts specific service/component. cli is default
Parameters used:
  HADOOP_HOME or HADOOP_PREFIX : Hadoop install directory
  HIVE_OPT : Hive options
For help on a particular service:
  ./hive --service serviceName --help
Debug help:  ./hive --debug --help

3、临时添加配置项:

命令行启动hive时,用--hiveconf hive.cli.print.header = true 
进入hive,执行 set hive.cli.print.header = true;

4、 访问本地/hdfs

  • 访问本地 : ! ls / –>用叹号
  • 访问hdfs : dfs -ls / –>不需要再去找namenode入口,直接去对hdfs进行操作,比用hdfs的dfs 命令快,性能消耗主要在启动进程上。
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值