在 hive-site.xml, 配置执行引擎为 tez。
<property>
<name>hive.execution.engine</name>
<value>tez</value>
<description>
Expects one of [mr, tez, spark].
Chooses execution engine. Options are: mr (Map reduce, default), tez, spark. While MR
remains the default engine for historical reasons, it is itself a historical engine
and is deprecated in Hive 2 line. It may be removed without further warning.
</description>
</property>
执行 hive 命令后,看到有两个 application 启动。
hive 执行后,有一个后台线程执行 tez session 的创建工作。还有一个是因为物化视图。
默认后台执行的设置
此参数默认是 true,即在后台创建 session,如果改为false,则 hive 的启动时间变长。后台和前台执行方式影响 Prepare plan 的时间。具体见分析 Hive 安全模式下 Prepare Plan 的时间分析
<property>
<name>hive.cli.tez.session.async</name>
<value>true</value>
<description>
Whether to start Tez
session in background when running CLI with Tez, allowing CLI to be available earlier.
</description>
</property>
物化视图
<property>
<name>hive.server2.materializedviews.registry.impl</name>
<value>DEFAULT</value>
<description>
Expects one of [default, dummy].
The implementation that we should use for the materialized views registry.
DEFAULT: Default cache for materialized views
DUMMY: Do not cache materialized views and hence forward requests to metastore
</description>
</property>
物化视图服务启动的时候,需要遍历所以数据库的物化视图,为 SQL 改写做准备,所以会有一个 session。
如果关闭,设置此参数为 DUMMY
。