4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Tez 0.5.2をHadoop 2.6.0で動かしてみる

Last updated at Posted at 2014-11-12

前提

Tez 0.5.2のインストール

基本的に、公式ドキュメントに従う

ソースコードをダウンロード、展開

$ wget https://dist.apache.org/repos/dist/dev/tez/tez-0.5.2-src-rc0/apache-tez-0.5.2-src.tar.gz
$ tar xf apache-tez-0.5.2-src.tar.gz
$ cd apache-tez-0.5.2-src

ビルド

Hadoop 2.6.0に対してビルドするために、pom.xmlを修正

pom.xml
diff --git a/pom.xml b/pom.xml
index dbf5923..28cd805 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,7 @@
   <properties>
     <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
     <clover.license>${user.home}/clover.license</clover.license>
-    <hadoop.version>2.4.0</hadoop.version>
+    <hadoop.version>2.6.0</hadoop.version>
     <jetty.version>7.6.10.v20130312</jetty.version>
     <distMgmtSnapshotsId>apache.snapshots.https</distMgmtSnapshotsId>
     <distMgmtSnapshotsName>Apache Development Snapshot Repository</distMgmtSnapshotsName>
@@ -74,6 +75,10 @@
       <name>${distMgmtSnapshotsName}</name>
       <url>${distMgmtSnapshotsUrl}</url>
     </repository>
+    <repository>
+      <id>org.apache.hadoop</id>
+      <url>https://repository.apache.org/content/repositories/orgapachehadoop-1012</url>
+    </repository>
   </repositories>
 
   <pluginRepositories>
@@ -89,6 +94,10 @@
       <url>${distMgmtSnapshotsUrl}</url>
       <layout>default</layout>
     </pluginRepository>
+    <pluginRepository>
+      <id>org.apache.hadoop</id>
+      <url>https://repository.apache.org/content/repositories/orgapachehadoop-1012</url>
+    </pluginRepository>
   </pluginRepositories>
  • Hadoop 2.6.0が正式リリースされたら、後半2つのdiff(レポジトリのURL設定)は不要になる
ビルドのコマンド
$ mvn clean package -DskipTests=true -Dmaven.javadoc.skip=true

HDFS上へTezのライブラリを配置

既にHDFSが動作していることを想定

$ hdfs dfs -mkdir -p /apps/tez-0.5.2
$ hdfs dfs -put tez-dist/target/tez-0.5.2.tar.gz /apps/tez-0.5.2/
  • tez-0.5.2.tar.gzのかわりにtez-0.5.2-minimal.tar.gzを使う方法もある。この場合、pom.xmlを編集してHadoopのバージョンを指定してビルドする必要はないが、tez-site.xmlを編集して、tez.use.cluster.hadoop-libsプロパティをtrueに設定する必要がある。

パラメータ設定

tez-site.xml
<configuration>
  <property>
    <name>tez.lib.uris</name>
    <value>${fs.defaultFS}/apps/tez-0.5.2/tez-0.5.2.tar.gz</value>
  </property>
</configuration>
  • MapReduce on Tezも試すので、mapred-site.xmlのプロパティmapreduce.framework.nameyarnからyarn-tezに修正する

クライアントにjarを配置

$ mkdir -p /usr/local/tez-jars/0.5.2
$ export TEZ_JARS=/usr/local/tez-jars/0.5.2
# export文は、bashrcあたりに書いておく
$ tar xvzf tez-dist/target/tez-0.5.2-minimal.tar.gz -C $TEZ_JARS

HADOOP_CLASSPATHに配備したjarを指定する

hadoop-env.sh
for f in $HADOOP_HOME/contrib/capacity-scheduler/*.jar; do
  if [ "$HADOOP_CLASSPATH" ]; then
    export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$f
  else
    export HADOOP_CLASSPATH=$f
  fi
done
+ 
+ # tez-site.xmlを配置したディレクトリを指定する
+ export TEZ_CONF_DIR=$HADOOP_HOME/etc/hadoop
+ 
+ export HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:${TEZ_CONF_DIR}:${TEZ_JARS}/*:${TEZ_JARS}/lib/*

# The maximum amount of heap to use, in MB. Default is 1000.
#export HADOOP_HEAPSIZE=
#export HADOOP_NAMENODE_INIT_HEAPSIZE=""

動作確認

ResourceManager, NodeManagerを起動し、MapReduceジョブを走らせる

  • とりあえずPiEstimator
$ hadoop jar hadoop-mapreduce-examples-2.6.0.jar pi 10 1000
Number of Maps  = 10
Samples per Map = 1000
14/11/12 17:34:50 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Wrote input for Map #0
Wrote input for Map #1
Wrote input for Map #2
Wrote input for Map #3
Wrote input for Map #4
Wrote input for Map #5
Wrote input for Map #6
Wrote input for Map #7
Wrote input for Map #8
Wrote input for Map #9
Starting Job
14/11/12 17:34:54 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032
14/11/12 17:34:55 INFO input.FileInputFormat: Total input paths to process : 10
14/11/12 17:34:55 INFO mapreduce.JobSubmitter: number of splits:10
14/11/12 17:34:56 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1415780973920_0001
14/11/12 17:34:56 INFO client.YARNRunner: Number of stages: 2
14/11/12 17:34:57 INFO client.TezClient: Tez Client Version: [ component=tez-api, version=0.5.2, revision=${buildNumber}, SCM-URL=scm:git:https://git-wip-us.apache.org/repos/asf/tez.git, buildTIme=2014-11-12T05:39:28Z ]
14/11/12 17:34:57 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032
14/11/12 17:34:57 INFO client.TezClient: Submitting DAG application with id: application_1415780973920_0001
14/11/12 17:34:57 INFO client.TezClientUtils: Using tez.lib.uris value from configuration: hdfs://localhost:9000/apps/tez-0.5.2/tez-0.5.2.tar.gz
14/11/12 17:34:57 INFO client.TezClient: Tez system stage directory hdfs://localhost:9000/tmp/hadoop-yarn/staging/root/.staging/job_1415780973920_0001/.tez/application_1415780973920_0001 doesn't exist and is created
14/11/12 17:34:57 INFO client.TezClient: Submitting DAG to YARN, applicationId=application_1415780973920_0001, dagName=QuasiMonteCarlo
14/11/12 17:34:57 INFO impl.YarnClientImpl: Submitted application application_1415780973920_0001
14/11/12 17:34:57 INFO client.TezClient: The url to track the Tez AM: http://localhost:8088/proxy/application_1415780973920_0001/
14/11/12 17:34:57 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032
14/11/12 17:34:57 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032
14/11/12 17:34:57 INFO mapreduce.Job: The url to track the job: http://localhost:8088/proxy/application_1415780973920_0001/
14/11/12 17:34:57 INFO mapreduce.Job: Running job: job_1415780973920_0001
14/11/12 17:35:14 INFO mapreduce.Job: Job job_1415780973920_0001 running in uber mode : false
14/11/12 17:35:14 INFO mapreduce.Job:  map 0% reduce 0%
14/11/12 17:36:07 INFO mapreduce.Job:  map 30% reduce 0%
14/11/12 17:36:08 INFO mapreduce.Job:  map 40% reduce 0%
14/11/12 17:36:09 INFO mapreduce.Job:  map 80% reduce 0%
14/11/12 17:36:10 INFO mapreduce.Job:  map 100% reduce 0%
14/11/12 17:36:10 INFO mapreduce.Job:  map 100% reduce 100%
14/11/12 17:36:10 INFO mapreduce.Job: Job job_1415780973920_0001 completed successfully
14/11/12 17:36:10 INFO mapreduce.Job: Counters: 0
Job Finished in 76.579 seconds
  • 細かいけど、revision=${buildNumber}と表示されているのはなんだか怪しい。Git repositoryをチェックアウトするのではなく、ソースコードを直接ダウンロードしてビルドしたからなのかな。

ResourceManagerのWebUIを見ても、確かにTEZで動いていることがわかる

Screen Shot 2014-11-12 at 18.08.34.png

  • 話がそれるが、StartTime, FinishTimeがGMTで表示される問題はHadoop 2.7.0で修正予定 (YARN-570)

最後に

Hive on Tezを試してみようとしたのですが、Tezのインストールだけで結構な量(ただし手順はそれほど多くない)になってしまったので、この記事はTezだけになりました。次の記事はHive on Tezの予定です。

追記 (2016/8/19)

最近のTezだとtez-uiが搭載されていて、ビルドするためにbzip2が必要。CentOS 7のminimalだと入っていないのでインストールしておく必要がある。

参考: http://qiita.com/kimutansk/items/8a91baf476fff4232634#%E5%BF%85%E8%A6%81%E7%92%B0%E5%A2%83%E3%83%91%E3%83%83%E3%82%B1%E3%83%BC%E3%82%B8%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?