Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Apache Spark 2: Data Processing and Real-Time Analytics

You're reading from   Apache Spark 2: Data Processing and Real-Time Analytics Master complex big data processing, stream analytics, and machine learning with Apache Spark

Arrow left icon
Product type Course
Published in Dec 2018
Publisher Packt
ISBN-13 9781789959208
Length 616 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Authors (7):
Arrow left icon
Sridhar Alla Sridhar Alla
Author Profile Icon Sridhar Alla
Sridhar Alla
Romeo Kienzler Romeo Kienzler
Author Profile Icon Romeo Kienzler
Romeo Kienzler
Siamak Amirghodsi Siamak Amirghodsi
Author Profile Icon Siamak Amirghodsi
Siamak Amirghodsi
Broderick Hall Broderick Hall
Author Profile Icon Broderick Hall
Broderick Hall
Md. Rezaul Karim Md. Rezaul Karim
Author Profile Icon Md. Rezaul Karim
Md. Rezaul Karim
Meenakshi Rajendran Meenakshi Rajendran
Author Profile Icon Meenakshi Rajendran
Meenakshi Rajendran
Shuen Mei Shuen Mei
Author Profile Icon Shuen Mei
Shuen Mei
+3 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (23) Chapters Close

Title Page
Copyright
About Packt
Contributors
Preface
1. A First Taste and What's New in Apache Spark V2 FREE CHAPTER 2. Apache Spark Streaming 3. Structured Streaming 4. Apache Spark MLlib 5. Apache SparkML 6. Apache SystemML 7. Apache Spark GraphX 8. Spark Tuning 9. Testing and Debugging Spark 10. Practical Machine Learning with Spark Using Scala 11. Spark's Three Data Musketeers for Machine Learning - Perfect Together 12. Common Recipes for Implementing a Robust Machine Learning System 13. Recommendation Engine that Scales with Spark 14. Unsupervised Clustering with Apache Spark 2.0 15. Implementing Text Analytics with Spark 2.0 ML Library 16. Spark Streaming and Machine Learning Library 1. Other Books You May Enjoy Index

Cluster management


The Spark context, as you will see in many of the examples in this book, can be defined via a Spark configuration object and Spark URL. The Spark context connects to the Spark cluster manager, which then allocates resources across the worker nodes for the application. The cluster manager allocates executors across the cluster worker nodes. It copies the application JAR file to the workers and finally allocates tasks.

The following subsections describe the possible Apache Spark cluster manager options available at this time.

Local

By specifying a Spark configuration local URL, it is possible to have the application run locally. By specifying local[n], it is possible to have Spark use n threads to run the application locally. This is a useful development and test option because you can also test some sort of parallelization scenarios but keep all log files on a single machine.

Standalone

Standalone mode uses a basic cluster manager that is supplied with Apache Spark. The spark master URL will be as follows:

Spark://<hostname>:7077

Here,<hostname>is the name of the host on which the Spark master is running. We have specified7077as the port, which is the default value, but this is configurable. This simple cluster manager currently supports only FIFO (first-in-first-out) scheduling. You can contrive to allow concurrent application scheduling by setting the resource configuration options for each application; for instance, usingspark.core.maxto share cores between applications.

Apache YARN

At a larger scale, when integrating with Hadoop YARN, the Apache Spark cluster manager can be YARN and the application can run in one of two modes. If the Spark master value is set as yarn-cluster, then the application can be submitted to the cluster and then terminated. The cluster will take care of allocating resources and running tasks. However, if the application master is submitted as yarn-client, then the application stays alive during the life cycle of processing, and requests resources from YARN.

Apache Mesos

Apache Mesos is an open source system, for resource sharing across a cluster. It allows multiple frameworks, to share a cluster by managing and scheduling resources. It is a cluster manager, that provides isolation using Linux containers and allowing multiple systems such as Hadoop, Spark, Kafka, Storm, and more to share a cluster safely. It is highly scalable to thousands of nodes. It is a master/slave-based system and is fault tolerant, using Zookeeper for configuration management.

For a single master node Mesos cluster, the Spark master URL will be in this form:

mesos://<hostname>:5050.

Here, <hostname> is the hostname of the Mesos master server; the port is defined as 5050, which is the default Mesos master port (this is configurable). If there are multiple Mesos master servers in a large-scale high availability Mesos cluster, then the Spark master URL would look as follows:

mesos://zk://<hostname>:2181.

So, the election of the Mesos master server will be controlled by Zookeeper. The <hostname> will be the name of a host in the Zookeeper quorum. Also, the port number, 2181, is the default master port for Zookeeper.

You have been reading a chapter from
Apache Spark 2: Data Processing and Real-Time Analytics
Published in: Dec 2018
Publisher: Packt
ISBN-13: 9781789959208
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime