./bin/spark-shell -h
Usage: ./bin/spark-shell [options]
Options:
--master MASTER_URL spark://host:port, mesos://host:port, yarn, or local.
--deploy-mode DEPLOY_MODE Whether to launch the driver program locally ("client") or
on one of the worker machines inside the cluster ("cluster")
(Default: client).
...
val spark = SparkSession
.builder
.appName("Spark Pi")
.getOrCreate()
那么如何从外壳开始呢?给你:
./bin/spark-shell --jars ./examples/jars/spark-examples_2.11-2.0.0.jar
scala> org.apache.spark.examples.SparkPi.main(Array("100"))
Pi is roughly 3.1413147141314712
1条答案
按热度按时间vktxenjb1#
1) 您可以连接您的spark shell和spark submit到mesos群集:
2) 有没有办法从spark shell运行一个示例(sparkpi)?
简言之-是的。但它可能只在spark 2.0中起作用。
sparkpi示例在spark1.6中的实现试图创建新的spark上下文(而sparkshell已经创建了一个上下文-这将导致问题)。
https://github.com/apache/spark/blob/branch-1.6/examples/src/main/scala/org/apache/spark/examples/sparkpi.scala
spark 2.0中的实现尝试重用现有spark上下文:https://github.com/apache/spark/blob/branch-2.0/examples/src/main/scala/org/apache/spark/examples/sparkpi.scala
那么如何从外壳开始呢?给你: