关于spark streaming新版本ssc创建不了问题
来源:互联网 发布:java项目有红色感叹号 编辑:程序博客网 时间:2024/06/06 13:01
之前因为工作需要于自己需要学习spark streaming,当然官网上介绍的很详细
然而,在我创建:
val ssc = new StreamingContext(sc, Seconds(1))
遇到了问题一直创建不了官网上给出的包是
importorg.apache.spark.SparkConfimport org.apache.spark.streaming.{Seconds,StreamingContext}后来创建上首次、时报出了没有这个方法,那就是包没导入
然后就去查了资料发现正确的应该是这样:
import org.apache.spark.streaming._ import org.apache.spark.streaming.StreamingContext._import org.apache.spark.api.java.function._import org.apache.spark.streaming._import org.apache.spark.streaming.api._
// Create a StreamingContext with a local masterval ssc = new StreamingContext(sc, Seconds(1))// Create a DStream that will connect to serverIP:serverPort, like localhost:9999val lines = ssc.socketTextStream("localhost", 9999)// Split each line into wordsval words = lines.flatMap(_.split(" "))import org.apache.spark.streaming.StreamingContext._// Count each word in each batchval pairs = words.map(word => (word, 1))val wordCounts = pairs.reduceByKey(_ + _)// Print a few of the counts to the consolewordCounts.print()ssc.start() // Start the computationssc.awaitTermination() // Wait for the computation to terminate
欢迎指教!
0 0
- 关于spark streaming新版本ssc创建不了问题
- Spark Streaming 的一些问题
- spark streaming 写hdfs问题
- Spark Streaming Accumulator 并发问题
- spark streaming 有趣问题汇总
- ssc
- spark streaming 的textFileStream读取不了数据原因分析
- onvif新版本发现不了老版本onvif的ipc问题
- Android 关于更新了新版本的SDK,创建项目出现appcompat_v7报错问题
- yarn-cluster运行spark streaming问题
- Spark Streaming Kafka CreateDirectDStreaming 遇见的问题
- spark streaming 读取kafka数据问题
- Spark streaming 作业需要注意的问题
- Spark Streaming
- spark streaming
- Spark/Streaming
- Spark Streaming
- spark streaming
- 机器学习模型优化中常见问题和解决思路
- HTTP2.0 HTTPS学习
- 《Python编程:从入门到实践 》[Eric Matthes著] 中文pdf非扫描版
- 【消息队列MQ】从MQ种类说起
- 1080. Graduate Admission 解析
- 关于spark streaming新版本ssc创建不了问题
- cas 4.2.5 返回更多的用户信息
- 多表透视图的制作 第一讲:数据规范化
- LeetCode之Distribute Candies
- PRVG-10122 : ASMLib configuration value
- redis
- 1081. Rational Sum 解析
- 爪哇(Java)的诞生、组成
- 机器学习 VS. 深度学习