[Original] briefly describes how to run a program in spark cluster mode

Source: Internet
Author: User

The premise of this article is that scala, sbt, and spark have been correctly installed. Briefly describe the steps to mount the program to the cluster for running: 1. Build the sbt standard project structure: Where :~ /Build. the sbt file is used to configure the basic information of the project (project name, organization name, project version, scala version used, or dependency packages required for re-configuring some projects); project/build. the version of sbt you want to use in the properties file configuration; project/plugins. the sbt file is used to add the required plug-ins to the project; project/Build. scala files are some complex advanced configuration for the project; For detailed sbt installation configuration practical see blog: http://www.cnblogs.com/vincent-hv/p/3309805.html 2, to the corresponding directory to write the program, spark program must create a SparkContext instance. SparkContext ("master", "projectName", "SPARK_HOME", "yourProject. jar path") 3. After the sbt compile command compiles the program correctly, the sbt package command packs the program. The default path for storing the packaged jar files is: project root directory/target/scala-xx.xx.xx/your-project-name_xx.xx.xx-xx.jar 4. Add the packaged jar price to SPAK_CLASSPATH (in linux There are multiple ways to change environment variables depending on the scope of action, here only my configuration method: spark root directory conf/spark-env.sh file add SPARK_CLASSPATH: xxxxxxxx) 5, After configuring the environment variables can be used in the spark root directory. the/run script runs your program, for example :. /run spark. examples. sparkPi spark: // masterIP: port Note: if the program involves IO operations, the default path is SPARK_HOME. How to modify this path remains to be studied

Related Article

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.