Hive 查看和修改 tez 容器的资源

1. 查看当前的配置

1.1 进入 AppMaster 或 History

进入运行中,或者运行完作业对应的 “Tracking URL”。以下示例是已经运行完的 job。
点击 Configurations

1.2 进入 tez-ui

进入 tez-ui 之后,点击 Configurations
在这里插入图片描述

1.3 查看配置

输入要查询的配置项,点击"Regex Search"。如果查询的值和默认值不一样,说明管理员修改了 tez-site.xml。

在这里插入图片描述

2. Tez 配置项

查看 tez-site.xml 可以看设置的配置项。查看 tez-default-template.xml 可以看到所有的配置项及默认值。

2.1 AppMaster 的 vcores 和 memory 配置项

  <property>
    <name>tez.am.resource.cpu.vcores</name>
    <defaultValue>1</defaultValue>
    <description>Int value. The number of virtual cores to be used by the app master</description>
    <type>integer</type>
  </property>

  <property>
    <name>tez.am.resource.memory.mb</name>
    <defaultValue>1024</defaultValue>
    <description>Int value. The amount of memory in MB to be used by the AppMaster</description>
    <type>integer</type>
  </property>

2.2 Container 的 vcores 和 memory 配置项

    <property>
    <name>hive.tez.container.size</name>
    <value>-1</value>
    <description>By default Tez will spawn containers of the size of a mapper. This can be used to overwrite.</description>
  </property>
  <property>
    <name>hive.tez.cpu.vcores</name>
    <value>-1</value>
    <description>
      By default Tez will ask for however many cpus map-reduce is configured to use per container.
      This can be used to overwrite.
    </description>
  </property>

默认按以上配置,如果值小于0。则按以下配置

mapreduce.map.memory.mb 默认: 1024
mapreduce.map.cpu.vcores 默认: 1

千万不要在 hive.tez.java.opts 配置项中添加 -Xmx 参数,因为 tez 引擎会根据容器的大小动态配置。默认是容器内存的 0.8 分配给 java 堆内存,由以下参数设置。

  <property>
    <name>tez.container.max.java.heap.fraction</name>
    <defaultValue>0.8</defaultValue>
    <description>Double value. Tez automatically determines the Xmx for the JVMs used to run
 Tez tasks and app masters. This feature is enabled if the user has not
 specified Xmx or Xms values in the launch command opts. Doing automatic Xmx
 calculation is preferred because Tez can determine the best value based on
 actual allocation of memory to tasks the cluster. The value if used as a
 fraction that is applied to the memory allocated Factor to size Xmx based
 on container memory size. Value should be greater than 0 and less than 1.

 Set this value to -1 to allow Tez to use different default max heap fraction
 for different container memory size. Current policy is to use 0.7 for container
 smaller than 4GB and use 0.8 for larger container.</description>
    <type>float</type>
  </property>

3. 动态更改配置项

由于 tez 引擎在连接 driver 的时候,就启动 AppMaster 和一定数量的 container(默认为0),所以动态设置不生效。

3.1 beeline 连接 Hive Server 的方式

beeline 设置 am 的内存的方法如下,其他参数类似。

beeline --hiveconf tez.am.resource.memory.mb=5120

设置容器的内

beeline --hiveconf hive.tez.container.size=4096

3.2 hive-cli

hive 命令行设置 am 的内存的方法如下,其他参数类似。

hive --hiveconf tez.am.resource.memory.mb=1024
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值