Before you configure:
First, we need to understand that when the hive CLI starts, will give priority to the implementation of file .hiverc before the hive> prompt appears, Hive will automatically look for a file named .hiverc at $ {HIVE_HOME} / bin directory, which can be in this file settings to configure some commonly used parameters.
(Because it is a hidden file, we can see with the Linux ls -a command. Without this file, you can directly create added configuration)
Start editing the file: $ {} /bin/.hiverc HIVIE_HOME
common configuration is as follows:
#在命令行中显示当前数据库名
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;
Restart hive, found that the effect is as follows: