2014-12-03 2 views
3

Spark 셸에서 예제 (SparkPi)를 실행할 수있는 방법이 있습니까? 또는 쉘을 통해 스파크 작업을 Mesos 클러스터에 제출 하시겠습니까? spark-submit은 현재 Mesos에 대한 배포를 지원하지 않지만 드라이버를 실행 프로그램에 배치하도록하기 위해 이와 같은 것을 달성하고자합니다.Spark 쉘을 Mesos에서 Spark로 실행하는 방법?

답변

0

1) 당신은 당신의 스파크 쉘을 연결하고 메소 클러스터에 불꽃 제출

./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). 
... 

2) 스파크 쉘에서 예 (SparkPi)를 실행하기 위해 어떤 방법이 있나요?

요컨대 - 예. 하지만 아마 Spark 2.0에서만 작동 할 것입니다.

SparkPix 1.6에서 SparkPi 예제를 구현하면 새로운 Spark Context를 만들려고 시도합니다 (spark-shell이 ​​이미 만들었지 만 문제가 발생할 것입니다). https://github.com/apache/spark/blob/branch-2.0/examples/src/main/scala/org/apache/spark/examples/SparkPi.scala

val spark = SparkSession 
    .builder 
    .appName("Spark Pi") 
    .getOrCreate() 

는 어떻게 셸에서 SparkPi을 시작 : 스파크 2.0 시도에서

https://github.com/apache/spark/blob/branch-1.6/examples/src/main/scala/org/apache/spark/examples/SparkPi.scala

val conf = new SparkConf().setAppName("Spark Pi") 
val spark = new SparkContext(conf) 

구현은 기존 스파크 컨텍스트를 재사용? 가자 :

./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        
관련 문제