Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

It is possible to start an embedded instance of apache Spark node?

I want to start an instance of a standalone Apache Spark cluster embedded into my java app. I tried to find some documentation at their website but not look yet.

Is this possible?

like image 406
Rodrigo Avatar asked Jun 25 '14 15:06

Rodrigo


People also ask

Can Spark be run locally?

It's easy to run locally on one machine — all you need is to have java installed on your system PATH , or the JAVA_HOME environment variable pointing to a Java installation. Spark runs on Java 8/11/17, Scala 2.12/2.13, Python 3.7+ and R 3.5+.

What is Spark instance?

Each Spark instance group is an installation of Apache Spark that can run Spark core services (Spark master, shuffle, and history) and notebooks as configured. You can create a Spark instance group to serve a line of business or a team within a business organization.


2 Answers

You can create SparkContext in local mode, you just need to provide "local" as a spark master url to SparkConf

val sparkConf = new SparkConf().
  setMaster("local[2]").
  setAppName("MySparkApp")

val sc = new SparkContext(sparkConf)
like image 189
Eugene Zhulenev Avatar answered Oct 21 '22 12:10

Eugene Zhulenev


Yes -- you can use Spark in an embedded way with a "local" master.

SparkConf sparkConf = new SparkConf();//Create new spark config
sparkConf.setMaster("local[8]"); // local, using 8 cores (you can vary the number)
sparkConf.setAppName("MyApp");
SparkContext sc = new SparkContext(sparkConf);

This will run Spark within your JVM.

like image 29
Daniel Winterstein Avatar answered Oct 21 '22 12:10

Daniel Winterstein