hadoop中hive的属性

1.在hive中是可以删除文件的:

hive> dfs -rm -R /u2.txt
    > ;
Deleted /u2.txt


2.hive 中的default数据库

<property>
    <name>hive.metastore.warehouse.dir</name>
    <value>/user/hive/warehouse</value>
    <description>location of default database for the warehouse</description>
  </property>

 
用default数据库创建表时,数据目录会在/user/hive/warehouse下


3.显示表头和默认数据库信息

hive> select * from u2;
OK
1       xm1     16      9       14
2       xm2     18      9       14
3       xm3     22      9       14
4       xh4     20      9       14
5       xh5     22      9       14
6       xh6     23      9       14
7       xh7     25      9       14
8       xh8     28      9       14
9       xh9     32      9       14
Time taken: 0.999 seconds, Fetched: 9 row(s)

 

需要修改:hive-site.xml 默认的都是false,修改为true

<property>
    <name>hive.cli.print.header</name>
    <value>true</value>
    <description>Whether to print the names of the columns in query output.</description>
</property>
 
<property>
    <name>hive.cli.print.current.db</name>
    <value>true</value>
    <description>Whether to include the current database in the Hive prompt.</description>
</property>


验证查询:

[hadoop@master sbin]$ hive

Logging initialized using configuration in file:/home/hadoop/hive/conf/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
hive (default)> use db_hive;
OK
Time taken: 3.207 seconds
hive (db_hive)> select * from u2;
OK
u2.id   u2.name u2.age  u2.month        u2.day
1       xm1     16      9       14
2       xm2     18      9       14
3       xm3     22      9       14
4       xh4     20      9       14
5       xh5     22      9       14
6       xh6     23      9       14
7       xh7     25      9       14
8       xh8     28      9       14
9       xh9     32      9       14
Time taken: 1.254 seconds, Fetched: 9 row(s)

 

启动时配置信息:

$ bin/hive --hiveconf <property=value>


查看所有的设置信息:

 hive>set -v;

 

查看一个属性值:

hive (db_hive)> set system:user.language ;
system:user.language=en

 

posted @ 2019-04-02 22:29  醉城、  阅读(228)  评论(0编辑  收藏  举报