-
编译tez的准备工作
-
hive-0.13.1-cdh5.3.6
-
hadoop-2.5.0-cdh5.3.6
-
maven 3.5.6 (maven 版本在3.0以上都可以)
-
-
protoc的版本是2.5.0 (可以参考 https://blog.csdn.net/sszzyzzy/article/details/89946075 )
-
开始编译
重点申明: 经过我的多次测试 hive-0.13 版本只能编译 tez-0.4.1-incubating, 如果编译 tez-0.4.1-incubating以上的版本会报错
至于为什么会报这个错请参考这篇博客 :http://www.bubuko.com/infodetail-579660.html
下载 tez-0.4.1-incubating-src.tar.gz (网址: http://archive.apache.org/dist/incubator/tez/tez-0.4.1-incubating/tez-0.4.1-incubating-src.tar.gz)
我的下载路径是: /opt/softwares/tez-0.4.1-incubating-src.tar.gz
然后解压: tar -zxvf tez-0.4.1-incubating-src.tar.gz -C /opt/modules
得到: tez-0.4.1-incubating-src 文件
然后进入到 tez-0.4.1-incubating-src 文件夹中进行编译:
注意:Maven 默认是不支持cdh的 所以需要配置库:
cloudera
https://repository.cloudera.com/artifactory/cloudera-repos/
Cloudera Repositories
false
<id>cloudera</id>
<name>Cloudera Repositories</name>
<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
将改好的settings.xml 分别放在你linux 系统的 .m2 和maven/conf 的文件夹下面。
.m2 文件夹在你的用户的家目录下 /home/hadoop/.m2 下面 他是一个隐藏文件 ls -a 可以看到
- 进入tez-0.4.1-incubating-src 目录下
修改pom.xml 文件
<hadoop.version>2.5.0-cdh5.3.6</hadoop.version>
https://repository.cloudera.com/artifactory/cloudera-repos/
<id>maven2-repository.atlassian</id>
<name>Atlassian Maven Repository</name>
<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
<layout>default</layout>
</pluginRepository>
vi tez-mapreduce/src/main/java/org/apache/tez/mapreduce/hadoop/mapreduce/JobContextImpl.java
在JobContexImpl.java类最后增加如下方法:
/** * Get the boolean value for the property that specifies which
classpath * takes precedence when tasks are launched. True - user’s
classes takes * precedence. False - system’s classes takes
precedence. * @return true if user’s classes should take precedence
*/ @Override public boolean userClassesTakesPrecedence() { return getJobConf().getBoolean(MRJobConfig.MAPREDUCE_JOB_USER_CLASSPATH_FIRST,
false); }
修改完成之后,开始编译 在
因为是tez-0.4.1 版本有点老了只有使用tez-0.4.1-incubating-src 使用命令
mvn clean package -Dtar -DskipTests=true -Dmaven.javadoc.skip=true
才会生成tar.gz 包
使用
mvn clean package -DskipTests=true -Dmaven.javadoc.skip=true
不会生成 tar.gz包,但是其他版本的tez 可以使用这条命令。
然后等待这条命令运行成功后到 /opt/modules/tez-0.4.1-incubating-src/tez-dist/target/tez-0.4.1-incubating.tar.gz 把 tar.gz 包考出来,解压到/opt/modules 改名字为 tez-0.4.1
然后配置hive :
vim hive-env.sh
添加 以下代码:
export TEZ_HOME=/opt/modules/tez-0.4.1 #是你的tez的解压目录
export TEZ_JARS=""
for jar in
ls $TEZ_HOME |grep jar; doexport TEZ_JARS=$TEZ_JARS:$TEZ_HOME/$jardone
for jar in
ls $TEZ_HOME/lib; doexport TEZ_JARS=$TEZ_JARS:$TEZ_HOME/lib/$jardone
export
HIVE_AUX_JARS_PATH=/opt/modules/hadoop-2.5.0-cdh5.3.6/share/hadoop/common/hadoop-lzo-0.4.20.jar$TEZ_JARS
在hive-site.xml文件中添加如下配置,更改hive计算引擎
<name>hive.execution.engine</name>
<value>tez</value>
最后 vim 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-0.4.1,${fs.defaultFS}/tez/tez-0.4.1/lib</value>
> </property> <property>
> <name>tez.lib.uris.classpath</name>
> <value>${fs.defaultFS}/tez/tez-0.4.1,${fs.defaultFS}/tez/tez-0.4.1/lib</value>
> </property> <property>
> <name>tez.use.cluster.hadoop-libs</name>
> <value>true</value> </property> <property>
> <name>tez.history.logging.service.class</name>
> <value>org.apache.tez.dag.history.logging.ats.ATSHistoryLoggingService</value>
> </property> </configuration>
将tez-0.4.1 上传到hdfs上
[atguigu@hadoop102 conf]$ hadoop fs -mkdir /tez
[atguigu@hadoop102 conf]$ hadoop fs -put /opt/module/tez-0.9.1/ /tez
[atguigu@hadoop102 conf]$ hadoop fs -ls /tez/tez/tez-0.9.1
启动Hive
[atguigu@hadoop102 hive]$ bin/hive
如果能启动成功就是配置成功了,如果没有则说明配置失败了。
下面我把我编译过的发到百度云上 可以下载查看:我把我编译过的tez-0.4.1和环境放在百度云上了

669

被折叠的 条评论
为什么被折叠?



