hive-0.13.1-cdh5.3.6 on tez-0.4.1-incubating-src.tar.gz 编译采坑

1 篇文章 0 订阅
0 篇文章 0 订阅
  1. 编译tez的准备工作

    1. hive-0.13.1-cdh5.3.6

    2. hadoop-2.5.0-cdh5.3.6

    3. maven 3.5.6 (maven 版本在3.0以上都可以)

  2. protoc的版本是2.5.0 (可以参考 https://blog.csdn.net/sszzyzzy/article/details/89946075 )

  3. 开始编译

重点申明: 经过我的多次测试 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 可以看到

  1. 进入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; do

export TEZ_JARS=$TEZ_JARS:$TEZ_HOME/$jar

done

for jar in ls $TEZ_HOME/lib; do

export TEZ_JARS=$TEZ_JARS:$TEZ_HOME/lib/$jar

done

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和环境放在百度云上了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值