背景
Ambari 2.7之后,TezUI默认不随集群一起部署了,当Tez任务有异常时想定位sql非常麻烦,每次部署的时候解决了问题,过段时间又忘了,手动记录一下吧。
部署tomcat
去清华镜像里找到最新的tomcat包https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/下载下来,上传到服务器上解压即可
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.88/bin/apache-tomcat-8.5.88.tar.gz
tar -xf apache-tomcat-8.5.88.tar.gz
部署Tez-ui的war包
官网下载tez-ui的最新war包https://repository.apache.org/content/repositories/releases/org/apache/tez/tez-ui/
解压后放到tomcat的webapp目录下
cd apache-tomcat-8.5.88/webapps
mkdir tez-ui && cd tez-ui
wget https://repository.apache.org/content/repositories/releases/org/apache/tez/tez-ui/0.10.2/tez-ui-0.10.2.war
unzip tez-ui-0.10.2.war
修改配置
修改tomcat端口
cd apache-tomcat-8.5.88/conf
vim server.xml
<Connector port="9999" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
maxParameterCount="1000"
/>
修改tez-ui配置,timeline填timeline server的host或ip
rm填resource mananger的host或ip,
建议都写成带统一后缀的域名如xxx.local,后面可以避免跨域问题,否则需要打开yarn的跨域配置
vim webapps/tez-ui/config/configs.js
timeline: "http://xxx.xxx.xxx.xxx:8188",
rm: "http://xxx.xxx.xxx.xxx:8088",
在Ambari页面修改tez和yarn的配置
tez: Custom tez-site
tez.tez-ui.history-url.base=http://<tomcat-host:9999/tez-ui/
tez.history.logging.service.class=org.apache.tez.dag.history.logging.ats.ATSHistoryLoggingService
yarn:
yarn.timeline-service.enabled=true(一般已经打开了,不用改)
yarn.timeline-service.hostname=timelineServer Host((一般已设置好,不用改))
yarn.timeline-service.http-cross-origin.enabled=true(如果浏览器访问的地址和configs.js填的不一样,需要设置为true,一般默认为true)
启动tomcat
cd apache-tomcat-8.5.88/
sh bin/startup.sh
到这步已经可以访问到tez-ui的页面了,但是往往此时只有页面没有数据,F12查看接口返回都是{entities: [ ]},往往是yarn的ACL问题
关闭yarn的acl
Ambari 里修改yarn配置
yarn:
yarn.acl.enable = false
或者新增dr.who
yarn.admin.acl = xxx,dr.who
增加hive hook
到这一步All DAGs 这个banner应该有内容了,但是Hive Queries里还是空
Ambari里修改hive配置
hive_timeline_logging_enabled = true
hive.exec.pre.hooks = org.apache.hadoop.hive.ql.hooks.ATSHook
hive.exec.post.hooks = org.apache.hadoop.hive.ql.hooks.ATSHook,org.apache.atlas.hive.hook.HiveHook
hive.exec.failure.hooks = org.apache.hadoop.hive.ql.hooks.ATSHook
到这里就算是配置完了,在ambari里重启hive、yarn、tez有关组件即可