본문 바로가기

옥탑방주인/Spark

[Spark] Spark Streaming - A QUICK Example 에서 에러

Spark Streaming 문서를 읽어보던 도중 초반부에 있는 quick example에서 에러가 발생하였다.


삽입한 코드는 아래의 내용과 같다.


import org.apache.spark._
import org.apache.spark.streaming._
import org.apache.spark.streaming.StreamingContext._ // not necessary since Spark 1.3

// Create a local StreamingContext with two working thread and batch interval of 1 second.
// The master requires 2 cores to prevent from a starvation scenario.

val conf = new SparkConf().setMaster("local[2]").setAppName("NetworkWordCount"

val ssc = new StreamingContext(conf, Seconds(1)) 


문제의 에러는 이렇다.



그런데 내용을 찬찬히 읽어보던 도중 set spark.driver 블라블라를 하라는 내용이 보인다.


그래서 다시 코드를 수정해서 입력하였다.


import org.apache.spark._
import org.apache.spark.streaming._
import org.apache.spark.streaming.StreamingContext._ // not necessary since Spark 1.3

// Create a local StreamingContext with two working thread and batch interval of 1 second.
// The master requires 2 cores to prevent from a starvation scenario.

val conf = new SparkConf().setMaster("local[2]").setAppName("NetworkWordCount").set("spark.driver.allowMultipleContexts", "true")  

val ssc = new StreamingContext(conf, Seconds(1))  



띠용?? 저 코드를 입력하면, 에러 없이 돌아가는 것을 확인할 수 있다.




'옥탑방주인 > Spark' 카테고리의 다른 글

Spark 2.2.0 Programming Guide  (0) 2017.10.23
Spark 2.2.0 Quick Start  (0) 2017.10.13
Spark 실행옵션  (0) 2017.08.18