无法将reducer的输出写入序列文件

8wtpewkr  于 2021-06-03  发布在  Hadoop
关注(0)|答案(0)|浏览(221)

我有一个map函数和一个reduce函数,输出类文本和intwritable的kep值对。。这只是main函数中map部分的要点:

TableMapReduceUtil.initTableMapperJob(
  tablename,        // input HBase table name
  scan,             // Scan instance to control CF and attribute selection
  AnalyzeMapper.class,   // mapper
  Text.class,             // mapper output key
  IntWritable.class,             // mapper output value
  job);

这是我在main函数中的reducer部分,它将输出写入hdfs

job.setReducerClass(AnalyzeReducerFile.class);
job.setNumReduceTasks(1);
FileOutputFormat.setOutputPath(job, new Path("hdfs://localhost:54310/output_file"));

如何让reducer改为写入序列文件?
我试过下面的代码,但不起作用

job.setReducerClass(AnalyzeReducerFile.class);
job.setNumReduceTasks(1);
job.setOutputFormatClass(SequenceFileOutputFormat.class);
SequenceFileOutputFormat.setOutputPath(job, new Path("hdfs://localhost:54310/sequenceOutput"));

编辑:这是我运行时得到的输出消息

WARN hdfs.DFSClient: DataStreamer Exception: org.apache.hadoop.ipc.RemoteException: org.apache.hadoop.hdfs.server.namenode.LeaseExpiredException: No lease on /sequenceOutput/_temporary/_attempt_local_0001_r_000000_0/part-r-00000 File does not exist. Holder DFSClient_NONMAPREDUCE_-79044441_1 does not have any open files.
13/07/29 17:04:20 WARN hdfs.DFSClient: Error Recovery for block null bad datanode[0] nodes == null
13/07/29 17:04:20 WARN hdfs.DFSClient: Could not get block locations. Source file "/sequenceOutput/_temporary/_attempt_local_0001_r_000000_0/part-r-00000" - Aborting...
13/07/29 17:04:20 ERROR hdfs.DFSClient: Failed to close file /sequenceOutput/_temporary/_attempt_local_0001_r_000000_0/part-r-00000

暂无答案!

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

相关问题