我的任务是从填充了pcap的hdfs中读取一个sequencefile,然后将一个特定的pcap写回hdfs(在hdfs中它将被下载到用户的浏览器)。
我是spark/scala的新手,但根据我目前所知,我相信我需要这样的伪代码:
// Read whole PCAP archive:
import org.apache.hadoop.io.Text
import org.apache.hadoop.io.IntWritable
val result = sc.sequenceFile("hdfs://path/to/pcap/archive", classOf[Text], classOf[IntWritable]).map{ turn into array of binary chunks, each representing a PCAP }
// Pick out PCAP from it:
val pcap_to_write = [select individual PCAP from result somehow]
// Write that PCAP back to HDFS:
val out = fs.create(new Path("hdfs://output/path/for/pcap"))
out.write(pcap_to_write);
out.close();
我假设这里面有错误,或者我的概念错了,任何提示/建议都非常感谢。
暂无答案!
目前还没有任何答案,快来回答吧!