参考地址:http://spark.apache.org/docs/1.5.2/job-scheduling.html#configuration-and-setup
1.配置hadoop/etc/yarn-site.xml
- <property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle,spark_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.spark_shuffle.class</name>
<value>org.apache.spark.network.yarn.YarnShuffleService</value>
</property>- <!-- 默认端口号 -->
- <property>
<value>7337</value>
</property>
2.拷贝spark-xxx-yarn-shuffle.jar到指定目录
拷贝spark-xxx-yarn-shuffle.jar到 hadoop/share/hadoop/yarn/里面
3.配置spark-default.conf
spark.shuffle.service.enabled true
spark.shuffle.service.prot 7337
Dynamic Allocation
| Property Name | Default | Meaning |
|---|---|---|
| spark.dynamicAllocation.enabled | false | Whether to use dynamic resource allocation, which scales the number of executors registered with this application up and down based on the workload. Note that this is currently only available on YARN mode. For more detail, see the description here. This requires spark.shuffle.service.enabled to be set. The following configurations are also relevant:spark.dynamicAllocation.minExecutors,spark.dynamicAllocation.maxExecutors, andspark.dynamicAllocation.initialExecutors |
| spark.dynamicAllocation.executorIdleTimeout | 60s | If dynamic allocation is enabled and an executor has been idle for more than this duration, the executor will be removed. For more detail, see thisdescription. |
| spark.dynamicAllocation.cachedExecutorIdleTimeout | infinity | If dynamic allocation is enabled and an executor which has cached data blocks has been idle for more than this duration, the executor will be removed. For more details, see this description. |
| spark.dynamicAllocation.initialExecutors | spark.dynamicAllocation.minExecutors | Initial number of executors to run if dynamic allocation is enabled. |
| spark.dynamicAllocation.maxExecutors | infinity | Upper bound for the number of executors if dynamic allocation is enabled. |
| spark.dynamicAllocation.minExecutors | 0 | Lower bound for the number of executors if dynamic allocation is enabled. |
| spark.dynamicAllocation.schedulerBacklogTimeout | 1s | If dynamic allocation is enabled and there have been pending tasks backlogged for more than this duration, new executors will be requested. For more detail, see this description. |
| spark.dynamicAllocation.sustainedSchedulerBacklogTimeout | schedulerBacklogTimeout | Same asspark.dynamicAllocation.schedulerBacklogTimeout, but used only for subsequent executor requests. For more detail, see this description. |
4.重启Yarn服务
版权声明:本文为kimsungho原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。