kafka+spark streaming能接收数据,但reduce之后没有结果
kafka发送消息,用spark streaming接收数据后做wordcount的例子,对数据进行split,能将数据print出来,但reduce之后print就出不来结果,而且貌似不再接收新的消息,如果把reduce注释掉后 ,就能循环不断的接收消息,何解,高人指点一下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"
instead of
"local"
as a parameter to instantiate the Spark context, in order to enable concurrent processing. 按照这种方式试一下
val wordCounts = words.map(x => (x, 1)).reduceByKeyAndWindow(_ + _, _ - _, Seconds(10s),seconds(2))
非常感谢,支持 至少要两个线程的
"local"
instead of
"local" 我记得官方文档明确说明这一点了的啊 {:soso_e154:}
页:
[1]