zoukankan      html  css  js  c++  java
  • hive 显示当前数据库名

    当hive CLI启动时,在hive > 提示符出现之前会优先执行文件.hiverc,Hive会自动在${HIVE_HOME}/bin目录下寻找名为.hiverc文件,由此可以在这个文件中设置配置一些常用的参数。由于它是隐藏文件,我们可以用Linux的ls -a命令查看。

    编写 .hiverc,参考链接, 有说放在   $HOME/.hiverc  或者 $HIVE_HOME/bin/.hiverc

    Putting the global hiverc in $HIVE_HOME/bin/.hiverc is deprecated. Please use $HIVE_CONF_DIR/.hiverc instead

       #在命令行中显示当前数据库名
        set hive.cli.print.current.db=true; 
        #查询出来的结果显示列的名称
        set hive.cli.print.header=true;
        #启用桶表
        set hive.enforce.bucketing=true;
        #压缩hive的中间结果
        set hive.exec.compress.intermediate=true;
        #对map端输出的内容使用BZip2编码/解码器
        set mapred.map.output.compression.codec=org.apache.hadoop.io.compress.BZip2Codec;
        #压缩hive的输出
        set hive.exec.compress.output=true;
        #对hive中的MR输出内容使用BZip2编码/解码器
        set mapred.output.compression.codec=org.apache.hadoop.io.compress.BZip2Codec;
        #让hive尽量尝试local模式查询而不是mapred方式
        set hive.exec.mode.local.auto=true;
    
    
    Wednesday, August 28, 2013
    Apache Hive: The .hiverc file
    What is .hiverc file?
    It is a file that is executed when you launch the hive shell - making it an ideal place for adding any hive configuration/customization you want set, on start of the hive shell. This could be:
    - Setting column headers to be visible in query results
    - Making the current database name part of the hive prompt
    - Adding any jars or files
    - Registering UDFs
    
    .hiverc file location
    The file is loaded from the hive conf directory.
    I have the CDH4.2 distribution and the location is: /etc/hive/conf.cloudera.hive1
    If the file does not exist, you can create it.
    It needs to be deployed to every node from where you might launch the Hive shell.
    [Note: I had to create the file;  The distribution did not come with it.]
    
    Sample .hiverc
    add jar /home/airawat/hadoop-lib/hive-contrib-0.10.0-cdh4.2.0.jar;
    set hive.exec.mode.local.auto=true;
    set hive.cli.print.header=true;
    set hive.cli.print.current.db=true;
    set hive.auto.convert.join=true;
    set hive.mapjoin.smalltable.filesize=30000000;
    关注公众号 海量干货等你
  • 相关阅读:
    如果使用EntityFramework6链接Mysql
    MongoDB联合查询 -摘自网络
    “TableDetails”中列“IsPrimaryKey”的值为DBNull. Mysql EntityFramework
    使用NPOI 转换Excel TO HTML (导出格式不如原生Excel好看)
    如何使用ODBC搭配dsn链接数据库
    Ubuntu16.04安装配置sublime text3
    ubuntu16.04编译安装php7.2
    ubuntu16.04安装flash player与谷歌浏览器(chrome)
    ubuntu16编译安装mysql5.7
    phpstorm+wamp+xdebug配置php调试环境
  • 原文地址:https://www.cnblogs.com/sowhat1412/p/12734259.html
Copyright © 2011-2022 走看看