scala - 运行spark NetworkWordCount示例时无输出

标签 scala apache-spark docker

我是spark的初学者,并且尝试使用docker运行spark示例NetworkWordCount。但是在运行示例时没有输出:

通过docker exec -it container_id bash启动一个新终端,

root@sandbox:/usr/local/spark# nc -lk 9999
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g
a ba c d e f g

然后启动另一个终端:
root@sandbox:/usr/local/spark# bin/run-example streaming.NetworkWordCount localhost 9999
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
16/05/12 02:55:57 INFO StreamingExamples: Setting log level to [WARN] for streaming example. To override add a custom log4j.properties to the classpath.
16/05/12 02:55:58 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
...

有人可以帮助我吗?

最佳答案

使用下面的命令执行对我有用。

[root@quickstart spark]# ./bin/run-example streaming.NetworkWordCount localhost 9999 --master "local[2]" 

关于scala - 运行spark NetworkWordCount示例时无输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37176564/

相关文章:

scala - Spark RDD 方法 "saveAsTextFile"抛出异常 即使在删除输出目录后也是如此。 org.apache.hadoop.mapred.FileAlreadyExistsException

build - 自动docker构建运行错误: Unable to find image

scala - 在 Scala Trait 中使用 Val

python - 如何在 PySpark 中创建一个返回字符串数组的 udf?

apache-spark - 查找事件的 Hadoop 镜像

apache-spark - 让Spark SQL知道Primary,Foreign,Not NULL约束的方法

mysql - WordPress 如何在 Docker 上运行

deployment - 如何用 Docker 实现 "One Binary"原则

Scala 理解签名

scala - 避免 Scala 中的类型转换