hive设置本地执行方式

假如hive中的SQL语句执行时间太长,可以设置本地执行方式,设置本地执行模式可以优化执行速度,数据量小的时候,使用本地模式:。
方式一:(z)
在hive的配置文件 hive-env.sh中将一些配置注释解开

export HADOOP_HEAPSIZE=1024

在SQL绘画中执行一下语句:

set hive.exec.mode.local.auto=true;

方式二:(Y)

set hive.exec.mode.local.auto=true;
set hive.exec.mode.local.auto.inputbytes.max=134217728;
set hive.exec.mode.local.auto.input.files.max=4;

以上这些配置,都可以写在 hive 的conf 下的 .hiverc 文件中,当hive启动的时候,就会加载

在hive的家目录下的conf文件夹下,创建  .hiverc 文件
cd /opt/installs/hive/conf 下面
touch .hiverc

在这个文件的里面进行如下配置:
set hive.exec.mode.local.auto=true;
// 文件大小小于128M
set hive.exec.mode.local.auto.inputbytes.max=134217728;
// 分片数量小于等于4,相当于是4个map任务
set hive.exec.mode.local.auto.input.files.max=4;
每次不清楚当前在哪个数据库下面,需要使用
select current_database(); 查看才可以,非常的麻烦,
可以在.hiverc 中设置如下配置:
set  hive.cli.print.current.db=true;

猜你喜欢

转载自blog.csdn.net/qq_43759478/article/details/131556485