欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

大数据的离线数据分析项目中,hive如何集入tez运行引擎

程序员文章站 2022-05-27 20:10:18
...

1、下载和安装tez
1)下载tez的依赖包,下载地址为:http://tez.apache.org
2)拷贝apache-tez-0.9.1-bin.tar.gz到anry2(anry2是我的主机名)的/anry/module目录下
[[email protected] module]$ ls
apache-tez-0.9.1-bin.tar.gz
3)解压缩apache-tez-0.9.1-bin.tar.gz
[[email protected] module]$ tar -zxvf apache-tez-0.9.1-bin.tar.gz
4)修改名称
[[email protected] module]$ mv apache-tez-0.9.1-bin/ tez-0.9.1

2、 在Hive中配置Tez
1)进入到Hive的配置目录:/anry/module/hive/conf
[[email protected] conf]$ pwd
/anry/module/hive/conf
2)在hive-env.sh文件中添加tez环境变量配置和依赖包环境变量配置
[[email protected] conf]$ vim hive-env.sh
添加如下配置
# Set HADOOP_HOME to point to a specific hadoop install directory
export HADOOP_HOME=/anry/module/hadoop-2.7.2

# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/anry/module/hive/conf

# Folder containing extra libraries required for hive compilation/execution can be controlled by:
export TEZ_HOME=/anry/module/tez-0.9.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=/anry/module/hadoop-2.7.2/share/hadoop/common/hadoop-lzo-0.4.20.jar$TEZ_JARS

3)在hive-site.xml文件中添加如下配置,更改hive计算引擎

<property>
    <name>hive.execution.engine</name>
    <value>tez</value>
</property>

3、 Tez自身的配置
1)在Hive的/opt/module/hive/conf下面创建一个tez-site.xml文件
[[email protected] conf]$ pwd
/anry/module/hive/conf

[[email protected] conf]$ 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.9.1,${fs.defaultFS}/tez/tez-0.9.1/lib</value>
</property>
<property>
	<name>tez.lib.uris.classpath</name>    	
	<value>${fs.defaultFS}/tez/tez-0.9.1,${fs.defaultFS}/tez/tez-0.9.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>

4、 上传Tez到集群中
1)将/anry/module/tez-0.9.1上传到HDFS的/tez路径
[[email protected] conf]$ hadoop fs -mkdir /tez
[[email protected] conf]$ hadoop fs -put /opt/module/tez-0.9.1/ /tez
[[email protected] conf]$ hadoop fs -ls /tez
/tez/tez-0.9.1

相关标签: 大数据 hive