apache tez 编译安装与验证

Apache Tez 是一种基于 Apache Hadoop YARN 的框架,它使用有向无环图(DAG)进行数据处理,提高了数据处理效率。通过支持复杂的 DAG 任务,Tez 能够简化原本需要多个 MapReduce 任务才能完成的工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

基本介绍

Apache Tez是构建于Apache Hadoop YARN上,基于有向无环图进行数据处理的框架。

主要设计主题:

  • 授权终端用户

    • 表达性数据流定义API

    • 灵活的输入处理输出运行模型

    • 数据类型无关

    • 极易部署

  • 执行性能

    • 优于mapreduce

    • 优化资源管理

    • 运行时计划重新配置

    • 动态物理数据流决策

通过允许像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

依赖安装
  1. 首先确保已经安装
  • jdk8

  • maven3

  1. protobuf-2.5.0安装
yum install protobuf protobuf-devel
源码编译

在确定我们使用的hadoop版本之后,选择合适的tez进行源码编译。这边以

  • tez-0.9.2

  • hadoop-3.2.0

为例对tez进行源码编译。

  1. 源码下载与解压
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

  1. 源码编译
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

参考:如何安装hadoop 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

得到结果:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

BigDataToAI

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值