分享

kafka+spark streaming能接收数据,但reduce之后没有结果

kafka发送消息,用spark streaming接收数据后做wordcount的例子,对数据进行split,能将数据print出来,但reduce之后print就出不来结果,而且貌似不再接收新的消息,如果把reduce注释掉后 ,就能循环不断的接收消息,何解,高人指点一下

kafka+spark streaming

kafka+spark streaming

已有(6)人评论

跳转到指定楼层
临云 发表于 2014-8-19 14:19:15
http://sluse.com/view/17362233  我勒个去,搜遍网络,只有这篇文章提到了解决方法



Just for the record: I got an answer in the Spark usergroup.
The error is that one has to use

"local[2]"
instead of

"local"
as a parameter to instantiate the Spark context, in order to enable concurrent processing.
回复

使用道具 举报

hyj 发表于 2014-8-19 16:35:37
按照这种方式试一下

  1. val wordCounts = words.map(x => (x, 1)).reduceByKeyAndWindow(_ + _, _ - _, Seconds(10s),seconds(2))
复制代码



回复

使用道具 举报

vicent 发表于 2014-8-20 16:11:08
非常感谢,支持
回复

使用道具 举报

hbbtym 发表于 2015-1-6 16:25:30
至少要两个线程的
"local[2]"
instead of

"local"
回复

使用道具 举报

梦回三国 发表于 2015-3-16 15:49:24
我记得官方文档明确说明这一点了的啊
回复

使用道具 举报

zhujun182104906 发表于 2015-3-19 14:50:15
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条