"Big Data Processing Architecture" 2. Use the SBT build tool to spark cluster

Source: Internet
Author: User

we use SBT to create, test, run, and submit jobs. This tutorial will explain all the SBT commands you will use in our course. the Tools Installation page explains how to install SBT. We typically make the code and libraries into jar packages that are submitted to the spark cluster via Spark-submit.

1) Download and install:

http://www.scala-sbt.org/

2) Create the project:

For example, now the project is called "Sparksample". So

2345 CDSparksamplemkdirProjectmkdirsrc/Main/Scala

The general engineering document structure is as follows:

  • project– Project Definition File
    • project/build/.scala– major Engineering definition files
    • project/build.properties– Engineering, SBT and Scala version definitions
  • src/main– your app code here, different subdirectory names represent different programming languages (for example, Src/main/scala,src/main/java)
  • src/main/resources– static files that you want to add to the jar package (for example, a log configuration file)
  • lib_managed– the jar file that your project relies on. Added to this directory when SBT is updated
  • target– the directory where the final generated files are stored (for example, generated thrift code, class file, jar file)

3) Write BUILD.SBT

Name: = "Spark Sample"
Version: = "1.0"
Scalaversion: = "2.10.3"
Librarydependencies + = "Org.apache.spark" percent "Spark-core"% "1.1.1"

It is important to note that the version used, the version of Scala and spark streaming, and so on.

http://mvnrepository.com/artifact/org.apache.spark/spark-streaming_2.10/1.4.1


4) Build the jar package.

Under Project's file directory (e.g. "sparksample")

> SBT Package

5) Submit to spark:

e.g:cd/opt/spark******

Bin/spark-submit--class "Org.apache.spark.examples.streaming.KafkaWordCount"--packages Org.apache.spark: spark-streaming-kafka_2.10:1.4.1--master local[2]  /home/ubuntu/kafkawordcount/target/scala-2.10/ Kafkawordcount_2.10-1.0.jar 10.81.52.88:9092 Tintin
Specific how to write parameters, please see the official:


Http://spark.apache.org/docs/latest/submitting-applications.html#submitting-applications
Note: The slight pit is that the calling package needs to be manually added to the---packages * * * * *.


Reference: HTTP://WWW.TUICOOL.COM/ARTICLES/AJNIVQ

Http://www.scala-sbt.org/release/docs/index.html

http://www.supergloo.com/fieldnotes/apache-spark-cluster-part-2-deploy-a-scala-program-to-spark-cluster/



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

"Big Data Processing Architecture" 2. Use the SBT build tool to spark cluster

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.