如何读取pcap的hadoop sequencefile并将单个pcap写入hdfs?

ccgok5k5  于 2021-07-13  发布在  Hadoop
关注(0)|答案(0)|浏览(190)

我的任务是从填充了pcap的hdfs中读取一个sequencefile,然后将一个特定的pcap写回hdfs(在hdfs中它将被下载到用户的浏览器)。
我是spark/scala的新手,但根据我目前所知,我相信我需要这样的伪代码:

  1. // Read whole PCAP archive:
  2. import org.apache.hadoop.io.Text
  3. import org.apache.hadoop.io.IntWritable
  4. val result = sc.sequenceFile("hdfs://path/to/pcap/archive", classOf[Text], classOf[IntWritable]).map{ turn into array of binary chunks, each representing a PCAP }
  5. // Pick out PCAP from it:
  6. val pcap_to_write = [select individual PCAP from result somehow]
  7. // Write that PCAP back to HDFS:
  8. val out = fs.create(new Path("hdfs://output/path/for/pcap"))
  9. out.write(pcap_to_write);
  10. out.close();

我假设这里面有错误,或者我的概念错了,任何提示/建议都非常感谢。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题