2017-04-05 91 views
-1

我正在使用apche spark(streaming)下的maven。並通過scala編程。 其實,我有一個小問題,下面的指令:apache spark Streaming error

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

如果我花邊的指令代碼是正確的。

這是我的全部代碼(網絡字數):

import org.apache.spark.SparkConf 
import org.apache.spark.streaming.{Seconds, StreamingContext} 
import org.apache.spark.storage.StorageLevel 

object WordCountStreaming { 
    def main(args: Array[String]): Unit = { 
    val conf = new SparkConf() .setMaster("local") 
      .setAppName("WordCountStreaming") 
      .set("spark.driver.allowMultipleContexts","true"); val sc= new 
    StreamingContext(conf , Seconds(1)) val lines = 
     sc.socketTextStream(args(0), args(1).toInt, 
    StorageLevel.MEMORY_AND_DISK_SER) sc.start() sc.awaitTermination() 
    } 
} 
+0

請添加錯誤日誌和代碼 – Kartoch

+0

進口org.apache.spark.SparkConf 進口org.apache.spark.streaming。{秒,的StreamingContext} 進口org.apache.spark.storage.StorageLevel 對象WordCountStreaming { 高清main(args:Array [String]):Unit = {0,1,2}真正」); val sc = new StreamingContext(conf,Seconds(1)) val lines = sc.socketTextStream(args(0),args(1).toInt,StorageLevel.MEMORY_AND_DISK_SER) sc.start() sc.awaitTermination } } –

+0

你知道你可以添加它的問題(我爲你做的)? – Kartoch

回答

0

在這裏,你可以請儘量給人以「本地[*]」或「本地[2]」在主因爲火花流着作品如果你在本地運行它,請使用主線程中的多個線程來嘗試它。

+0

編譯時出錯maven。如果我離開上述指示,我已經試圖糾正它。該錯誤將消失val sc = new StreamingContext(conf,Seconds(1)) –

+0

可以請您提供錯誤日誌 –

+0

請參閱使用代碼!我們如何回答?! – Kartoch