Spark3000 disciple Sixth Master Spark cluster Building summary

Source: Internet
Author: User

Listen to the sixth lesson of Liaoliang tonight. Proficient in spark cluster building and testing, after-school work is: Build your own spark environment and successfully run PI, my summary is as follows:

1 Hardware environment:

At least 8GB memory, recommended Kingston memory, virtual machine recommended Ubuntu Kylin version, can install various Office software including Sogou input method.
Internet access: Nat,root permissions login, avoid permissions issues

2. Software Environment:

RedHat 6.4 Spark 1.6.0 Hadoop 2.6.0 Scala 2.11.8

3/etc/hosts Ip-hostname Correspondence Relationship

spark.eventLog.enabled true records spark run events for ease of operation
./ Start

spark://master:7077 Default Port

4 Pi Program

Object SPARKPI {
def main (args:array[string]) {
Val conf = new sparkconf (). Setappname ("Spark Pi")
Val spark = new Sparkcontext (conf)
Val slices = if (args.length > 0) args (0). ToInt Else 2
Val n = math.min (100000L * slices, int.maxvalue). ToInt//Avoid overflow
Val count = spark.parallelize (1 until n, slices). map {i =
Val x = random * 2-1
Val y = random * 2-1
if (x*x + y*y < 1) 1 Else 0
}.reduce (_ + _)
println ("Pi is roughly" + 4.0 * count/n)
Spark.stop ()

5 Operation Result:

./bin/spark-submit \
--class org.apache.spark.examples.SparkPi \
--master spark://master:7077 \
./lib/spark-examples-1.6.0-hadoop2.6.0.jar \

Follow-up courses can be referred to Sina Weibo Liaoliang _dt Big Data Dream Factory: Http://

Spark3000 disciple Sixth Master Spark cluster Building summary

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: 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.