Spark-sql on Yarn Auto-Adjust executor number configuration

Source: Internet
Author: User
Tags shuffle

The latest Spark 1.2 version supports spark application for spark on yarn mode to automatically adjust the number of executor based on task, to enable this feature, you need to do the following:One:

In all NodeManager, modify Yarn-site.xml, add Spark_shuffle value for Yarn.nodemanager.aux-services, Set the Yarn.nodemanager.aux-services.spark_shuffle.class value to Org.apache.spark.network.yarn.YarnShuffleService, as follows:

   
  
 
  1. <property>
  2. <name>yarn.nodemanager.aux-services</name>
  3. <value>mapreduce_shuffle,spark_shuffle<alue>
  4. </property>
  5. <property>
  6. <name>yarn.nodemanager.aux-services.spark_shuffle.class</name>
  7. <value>org.apache.spark.network.yarn.YarnShuffleService</value>
  8. </property>
Two:

Copy the $SPARK _home/lib/spark-1.2.0-yarn-shuffle.jar file to the Hadoop-yarn/lib directory (that is, the Library directory of Yarn)

Three:

Configure $SPARK _home/conf/spark-default.xml, add the following two items

   
 
   
  
  1. Spark . dynamicallocation . 1#最小Executor数
  2. Spark . dynamicallocation . #最大Executor数
Four:

When executing, turn on the auto-adjust executor number switch to Spark-sql yarn client mode as an example:

   
  
 
  1. Spark - SQL \
  2. -- Master yarn \
  3. -- Deploy - mode client \
  4. -- conf Spark . Shuffle . Service . enabled = true \
  5. -- conf Spark . dynamicallocation . enabled = true \
  6. - e "Select COUNT (*) from XX"

The same is true for using Spark-submit:

   
  
 
  1. Spark - submit \
  2. -- class syspark. Sqlonspark \
  3. -- Master Yarn - client \
  4. -- conf Spark . Shuffle . Service . enabled = true \
  5. -- conf Spark . dynamicallocation . enabled = true \
  6. / Data / Jars / Sqlonspark . jar \
  7. "Select COUNT (*) from XX"

Spark-sql on Yarn Auto-Adjust executor number configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.