问题描述
在Hive中使用Tez计算引擎执行SQL任务时,Map和Reduce都处于Pending状态。
解决思路
查看任务的ApplicationMaster的container日志如下:
2016-09-13 17:14:52,103 [INFO] [DelayedContainerManager] |rm.YarnTaskSchedulerService|: Releasing held container as either there are pending but unmatched requests or this is not a session, containerId=container_e14_1473755328049_0004_01_000002, pendingTasks=1, isSession=true. isNew=true
2016-09-13 17:14:52,350 [WARN] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Held container expected to be not null for a non-AM-released container
2016-09-13 17:14:52,351 [INFO] [AMRM Callback Handler Thread] |rm.YarnTaskSchedulerService|: Ignoring unknown container: container_e14_1473755328049_0004_01_000002
Hive执行Tez引擎任务中Cpu资源设置涉及到的主要参数如下所示:
- mapreduce.map.cpu.vcores
- mapreduce.reduce.cpu.vcores
- yarn.scheduler.minimum-allocation-vcores
- hive.tez.cpu.vcores
mapreduce.map.cpu.vcores
Default Value: 1
The number of virtual cores to request from the scheduler for each map task.
mapreduce.reduce.cpu.vcores
Default Value: 1
The number of virtual cores to request from the scheduler for each reduce task.
yarn.scheduler.minimum-allocation-vcores
Default Value: -1
The minimum allocation for every container request at the RM, in terms of virtual CPU cores. Requests lower than this won't take effect, and the specified value will get allocated the minimum.
hive.tez.cpu.vcores
Default Value: -1
Added In: Hive 0.14.0 with HIVE-8452
By default Tez will ask for however many CPUs MapReduce is configured to use per container. This can be used to overwrite the default.
解决
查看ambari上Hive的参数配置发现,参数hive.tez.cpu.vcores被设置为10。
在Hive客户端中set此参数为默认值或者1即可。
进一步测试
- 当hive.tez.cpu.vcores设置小于1时,将被mapreduce.map.cpu.vcores值覆盖。
- mapreduce.reduce.cpu.vcores对于Tez任务来说不起任何作用不起作用。
- yarn.scheduler.minimum-allocation-vcores对于Tez任务来说不起任何作用不起作用。
测试结果如下伪代码:
if hive.tez.cpu.vcores = 1 then
任务Running。
elseif hive.tez.cpu.vcores > 1 then
任务Pending。
elseif hive.tez.cpu.vcores < 1 then
if mapreduce.map.cpu.vcores = 1 or 0 then
任务Running
elseif mapreduce.map.cpu.vcores > 1 then
任务Pending
elseif mapreduce.map.cpu.vcores < 0 then
任务Error
来源:oschina
链接:https://my.oschina.net/u/2723198/blog/749843