更换为Tez计算引擎
准备环境:
apache-tez-0.10.3-bin.tar.gz
下载地址:Index of /apache/tez (tsinghua.edu.cn)
步骤:
1.将apache-tez-0.10.3-bin.tar.gz包上传到安装hive的节点服务器,放到/opt/software目录下;
2.解压apache-tez-0.10.3-bin.tar.gz包到/opt/module目录下,并修改hive文件夹的名称为“tez-0-10.3”;
root@hadoopMaster:/opt/software# tar -zxvf apache-tez-0.10.3-bin.tar.gz -C /opt/module/
root@hadoopMaster:/opt/module# mv apache-tez-0.10.3-bin/ tez-0-10.3
3.将apache-tez-0.10.3-bin.tar.gz包上传到HDFS;
root@hadoopMaster:/opt/module/hadoop-3.3.6/sbin# hadoop fs -mkdir /tez
root@hadoopMaster:/opt/module/hadoop-3.3.6/sbin# hadoop fs -put /opt/software/apache-tez-0.10.3-bin.tar.gz /tez
上传完成后,打开http://HadoopMaster:9870/explorer.html#/网页,可以看到目录列表多了一个tez目录,点击目录后,可以看到刚刚上传的gz包,如下图所示:
4.进入到hive的conf目录下,新增tez-site.xml文件,新增如下内容:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>tez.lib.uris</name>
<value>${fs.defaultFS}/tez/apache-tez-0.10.3-bin.tar.gz</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>
5.修改hive-env.sh文件,增加如下内容:
export TEZ_HOME=/opt/module/tez-0-10.3
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
TEZ_JARS=${TEZ_JARS:1}
HIVE_AUX_JARS_PATH=$TEZ_JARS
6.修改 hive-site.xml
文件,增加如下内容:
<property>
<name>hive.execution.engine</name>
<value>tez</value>
</property>
7.修改yarn-site.xml文件:
root@hadoopMaster:/opt/module/hive/conf# cd /opt/module/hadoop-3.3.6/etc/hadoop/
root@hadoopMaster:/opt/module/hadoop-3.3.6/etc/hadoop# vi yarn-site.xml
增加如下内容:
<!-- 调大内存,推荐设置项(yarn默认是1024,可以根据自己服务器的实际内存合理分配) -->
<property>
<name>yarn.scheduler.minimum-allocation-mb</name>
<value>4096</value>
</property>
<!-- 关掉虚拟内存检查 -->
<property>
<name>yarn.nodemanager.vmem-check-enabled</name>
<value>false</value>
</property>
8.将yarn-site.xml文件进行分发,重启hadoop集群,重启hive服务:
分发文件:
root@hadoopMaster:/opt/module/hadoop-3.3.6/sbin# /bin/xsync /opt/module/hadoop-3.3.6/etc/hadoop/
重启hadoop,重启hive(hive可以使用kill 9 进程号 关闭hive进程):
root@hadoopMaster:/opt/module/hadoop-3.3.6/sbin# myhadoop.sh stop
root@hadoopMaster:/opt/module/hadoop-3.3.6/sbin# myhadoop.sh start
root@hadoopMaster:/opt/module/hadoop-3.3.6/sbin# nohup $HIVE_HOME/bin/hive --service hiveserver2 &
tez的更换就此完成,可以测试一下,速度会有提升。