• 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.vcoresname>
        <defaultValue>1defaultValue>
        <description>Int value. The number of virtual cores to be used by the app masterdescription>
        <type>integertype>
      property>
    
      <property>
        <name>tez.am.resource.memory.mbname>
        <defaultValue>1024defaultValue>
        <description>Int value. The amount of memory in MB to be used by the AppMasterdescription>
        <type>integertype>
      property>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    2.2 Container 的 vcores 和 memory 配置项

        <property>
        <name>hive.tez.container.sizename>
        <value>-1value>
        <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.vcoresname>
        <value>-1value>
        <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>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

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

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

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

      <property>
        <name>tez.container.max.java.heap.fractionname>
        <defaultValue>0.8defaultValue>
        <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>floattype>
      property>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    3. 动态更改配置项

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

    3.1 beeline 连接 Hive Server 的方式

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

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

    设置容器的内

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

    3.2 hive-cli

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

    hive --hiveconf tez.am.resource.memory.mb=1024
    
    • 1
  • 相关阅读:
    Git(11)——Git相关问题解答以及常用命令总结
    Unity3D 框架如何搭建基于纯Lua的U框架与开发模式详解
    Matlab如何导入Excel数据并进行FFT变换
    No mapping for GET /swagger-ui.html的解决方法
    Ansible自动化
    Mybatis中where标签和if标签结合使用说明
    【uni-app】uni项目打包微信小程序中使用 ECharts (mpvue-echarts)
    AI视频教程下载-ChatGPT速成课程:工作中的ChatGPT入门
    基础DFS与BFS
    基于SSM的视频点播系统设计与实现
  • 原文地址:https://blog.csdn.net/houzhizhen/article/details/128097658