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?
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+.
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.
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)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With