tez-ui部署

2,518 阅读1分钟

在HDP平台3.0版本之后移除了TEZ view组件。但是hive默认跑的引擎就是tez,yarn自带的resourcemanager ui看到的任务日志是applicaion级别的,且看不到执行的sql,日志看起来非常麻烦不好定位问题。部署tez-ui的话可以看到sql,timeline等,且日志是dag级别的,更方便定位问题。这里参考网上信息手动进行tez-ui部署。

tomcat安装

  1. 选择一个版本的tomcat下载download,这里我用的是tomcat9;

    cd /opt/
    wget https://mirrors.bfsu.edu.cn/apache/tomcat/tomcat-9/v9.0.39/bin/apache-tomcat-9.0.39.zip
    unzip apache-tomcat-9.0.39.zip
    
  2. 修改tomcat端口为tez-ui默认端口9999,配置文件为/apache-tomcat-9.0.39/conf/server.xml:

    <Connector port="9999" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" />
    
  3. 启动tomcat:

    cd /opt/apache-tomcat-9.0.39/bin
    chmod u+x catalina.sh startup.sh shutdown.sh
    ./startup.sh
    

tez-ui部署

  1. 根据所用tez选择一个版本的tez-ui下载Releases,这里我用的是0.9.1:

    cd /opt
    wget https://mirrors.bfsu.edu.cn/apache/tez/0.9.1/
    tar -zxvf apache-tez-0.9.1-bin.tar.gz
    
  2. 将解压目录中的tez-ui-0.9.1.war 解压到tomcat中:

    mkdir /opt/apache-tomcat-9.0.39/webapps/tez-ui  
    cd /opt/apache-tomcat-9.0.39/webapps/tez-ui
    jar -xvf tez-ui-0.9.1.war 
    
  3. 修改tez-ui配置文件./config/configs.env,主要修改rm和timeline的地址:

    ENV = {
      hosts: {
        timeline: "http://node2:8188",
    
        rm: "http://node1:8088",
        //rmProxy: "http://localhost:8088",
      },
    
      //timeZone: "UTC",
      //yarnProtocol: "<value>",
    };
    

配置

除了tomcat和tez-ui的配置外,hadoop中相关组件也需要做配置

  1. tez-site.xml:

    tez.am.view-acls: *
    tez.tez-ui.history-url.base: http://your-host:9999/tez-ui/
    tez.am.tez-ui.history-url.template: __HISTORY_URL_BASE__?viewPath=/#/tez-app/__APPLICATION_ID__
    tez.history.logging.service.class: org.apache.tez.dag.history.logging.ats.ATSHistoryLoggingService
    
  2. hive-site.xml:

    hive.server2.enable.doAs: true
    hive_timeline_logging_enabled: true
    
  3. yarn-site.xml:

    yarn.timeline-service.enabled: true
    hadoop.http.cross-origin.allowed-origins: *
    yarn.nodemanager.webapp.cross-origin.enabled: true
    yarn.resourcemanager.webapp.cross-origin.enabled: true
    yarn.timeline-service.http-cross-origin.enabled: true
    

效果

配置好后修改相关组件即可在http://your-host:9999/tez-ui/看到dag相关信息了:

  1. DAG日志视图:

  2. DAG详情,可以看到任务数,执行sql等信息:

  3. 计算图:

  4. timeline:

参考文档

  1. Tez UI Overview
  2. HDP3 集成 TEZ_UI