Skip to content

Instantly share code, notes, and snippets.

@ericzhong
Last active December 30, 2019 07:48
Show Gist options
  • Save ericzhong/0fb9799703a8dc0715bba03b182cdabd to your computer and use it in GitHub Desktop.
Save ericzhong/0fb9799703a8dc0715bba03b182cdabd to your computer and use it in GitHub Desktop.
Tez 安装与使用

安装

环境:

CentOS 7.4
hadoop-2.7.4

下载:

wget http://mirror.ox.ac.uk/sites/rsync.apache.org/tez/0.9.0/apache-tez-0.9.0-bin.tar.gz
tar xvf apache-tez-0.9.0-bin.tar.gz

将 Tez 包上传到 HDFS:

hdfs dfs -mkdir /tez     # 自定义目录
hdfs dfs -put share/tez.tar.gz  /tez
hdfs dfs -ls /tez

新建 conf/tez-site.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
  <property>
    <name>tez.lib.uris</name>
    <value>${fs.defaultFS}/tez/tez.tar.gz</value>
  </property>
</configuration>

MapReduce 方式

修改 Hadoop 配置文件 etc/hadoop/hadoop-env.sh

export TEZ_HOME=/home/vagrant/apps/apache-tez-0.9.0-bin
export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$TEZ_HOME/*:$TEZ_HOME/lib/*:$TEZ_HOME/conf/

修改 Hadoop 配置文件 mapred-site.xml

<property>
  <name>mapreduce.framework.name</name>
  <value>yarn-tez</value>
</property>

如果 Hadoop 是分布式部署,则所有节点都要修改。然后重启 Hadoop 集群。

提交一个任务:

cd apache-tez-0.9.0-bin
hdfs dfs -put conf/*.xml input
hadoop jar tez-examples-0.9.0.jar orderedwordcount input output
hdfs dfs -cat output/*

查看网页 http://localhost:8088,可以看到 Application Type 是 TEZ。

Hive 方式

Troubleshooting

Error: Could not find or load main class org.apache.tez.dag.app.DAGAppMaster

@AndreyEmelyanenko
Copy link

HI!
Have you solved this issue? How
Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment