Spark Streaming不读取来自其他ip的输入

时间:2016-02-22 14:35:53

标签: apache-spark spark-streaming

我在Spark Streaming上下文中,我正在使用nc -lk 9999从套接字读取输入。当我运行它并手动输入它时它正在工作。 但是,如果输入来自不同的ip到此套接字,那么spark不会读取该输入,尽管它显示来自nc -lk 9999下的不同源的所有输入。但不知何故火花没有读取它,而如果我复制并粘贴相同的数据,它可以工作。

我不确定会出现什么问题。有没有人有这个想法?提前谢谢。

供参考,我的程序:

def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setAppName("HBaseStream")
    val sc = new SparkContext(conf)
    // create a StreamingContext, the main entry point for all streaming functionality
    val ssc = new StreamingContext(sc, Seconds(2))
    val inputStream = ssc.socketTextStream(<hostname>, 9999)
    .......
}

来自此套接字的不同主机的数据: [root @~] #nc -lk 9999 56b4b2b23c24c3608376d1f01,id1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 56b4b2b23c24c3608376d1f0,id2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

0 个答案:

没有答案