有两种创建StreamingContext的方式:
第一种通过SparkConf
[mw_shl_code=scala,true]val conf = new SparkConf().setAppName(appName).setMaster(master);
val ssc = new StreamingContext(conf, Seconds(1));[/mw_shl_code]
第二种 还可以使用已有的SparkContext来创建
[mw_shl_code=scala,true]val sc = new SparkContext(conf)
val ssc = new StreamingContext(sc, Seconds(1))[/mw_shl_code]
appName, 是用来在Spark UI上显示的应用名称。 master, 是一个Spark、 Mesos或者Yarn集群
的URL, 或者是local。
|