基本介绍
Apache Tez是构建于Apache Hadoop YARN上,基于有向无环图进行数据处理的框架。
主要设计主题:
通过允许像Apache Hive和Apache Pig这样的项目运行复杂的DAG任务,Tez可以用来处理数据,以前需要多个MR任务,现在只需要一个Tez任务,如下所示。
下载地址
https://tez.apache.org/releases/index.html
安装部署
版本适配
对于Tez版本0.8.3和更高,Tez需要Apache Hadoop版本2.6.0或更高。对于Tez版本0.9.0及更高版本,Tez需要Apache Hadoop版本2.7.0或更高。所以说,我们在选用tez时,是需要先确定我们的hadoop版本的。
适配hadoop版本进行tez源码编译
编译平台
操作系统:centos 7.6
cpu架构:x86_64
依赖安装
- 首先确保已经安装
-
jdk8
-
maven3
- protobuf-2.5.0安装
yum install protobuf protobuf-devel
源码编译
在确定我们使用的hadoop版本之后,选择合适的tez进行源码编译。这边以
-
tez-0.9.2
-
hadoop-3.2.0
为例对tez进行源码编译。
- 源码下载与解压
wget https://mirror.olnevhost.net/pub/apache/tez/0.9.2/apache-tez-0.9.2-src.tar.gz
tar zxvf apache-tez-0.9.2-src.tar.gz
- 源码编译
cd apache-tez-0.9.2-src && mvn clean package -Dtar -Dhadoop.version=3.2.0 -DskipTests
编译完成之后,得到tez-dist/target/tez-0.9.2.tar.gz
功能测试
首先确保hadoop正常安装,包括hdfs和yarn
将tez-0.9.2.tar.gz上传到hdfs的/app/tez目录
hdfs dfs -put tez-0.9.2.tar.gz /app/tez/
新建tez目录,并将tez-0.9.2.tar.gz复制到tez钟
mkdir -p /data/tez/conf
cp tez-0.9.2.tar.gz /data/tez
cd /data/tez && tar zvf tez-0.9.2.tar.gz
新建tez-site.xml,内容如下
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<configuration>
<property>
<name>tez.lib.uris</name>
<value>/app/tez/tez-0.9.2.tar.gz</value>
</property>
</configuration>
修改/etc/profile,新增
export TEZ_CONF_DIR=/data/tez/conf
export HADOOP_CLAsspATH=$HADOOP_CLAsspATH:$TEZ_CONF_DIR:/data/tez/*:/data/tez/lib/*
修改mapred-site.xml,将
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
改为
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
执行测试脚本:
hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.2.0.jar wordcount /test/ output-1
得到结果:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。