Flume HDFS Sink写入错误“无协议:值”

时间:2019-07-15 09:26:48

标签: hadoop hdfs flume

当尝试运行水槽作业时,出现以下错误。我在cloudera设置上运行它。

  • 卡夫卡是源头
  • Morphline用作拦截器,可从中创建avro记录。
  • 接收器是HDFS

在测试环境中的文件完全相同(morphline,avro模式等,flume config)。但是在另一个环境中,它将引发此错误。

2019-07-15 14:24:17,669 WARN org.apache.flume.sink.hdfs.BucketWriter: Caught IOException writing to HDFSWriter (no protocol: value). Closing file (hdfs://8.8.8.8:8020/user/hive/warehouse/folder/folder/FlumeData.1563162656585.tmp) and rethrowing exception.
2019-07-15 14:24:17,670 INFO org.apache.flume.sink.hdfs.BucketWriter: Closing hdfs://8.8.8.8:8020/user/hive/warehouse/folder/folder/FlumeData.1563162656585.tmp
2019-07-15 14:24:17,670 ERROR org.apache.flume.sink.hdfs.HDFSEventSink: process failed
java.lang.NullPointerException
        at org.apache.flume.sink.hdfs.AvroEventSerializer.flush(AvroEventSerializer.java:187)
        at org.apache.flume.sink.hdfs.HDFSDataStream.close(HDFSDataStream.java:131)
        at org.apache.flume.sink.hdfs.BucketWriter$3.call(BucketWriter.java:327)
        at org.apache.flume.sink.hdfs.BucketWriter$3.call(BucketWriter.java:323)
        at org.apache.flume.sink.hdfs.BucketWriter$9$1.run(BucketWriter.java:701)
        at org.apache.flume.auth.SimpleAuthenticator.execute(SimpleAuthenticator.java:50)
        at org.apache.flume.sink.hdfs.BucketWriter$9.call(BucketWriter.java:698)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
2019-07-15 14:24:17,671 ERROR org.apache.flume.SinkRunner: Unable to deliver event. Exception follows.
org.apache.flume.EventDeliveryException: java.lang.NullPointerException
        at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:451)
        at org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:67)
        at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:145)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
        at org.apache.flume.sink.hdfs.AvroEventSerializer.flush(AvroEventSerializer.java:187)
        at org.apache.flume.sink.hdfs.HDFSDataStream.close(HDFSDataStream.java:131)
        at org.apache.flume.sink.hdfs.BucketWriter$3.call(BucketWriter.java:327)
        at org.apache.flume.sink.hdfs.BucketWriter$3.call(BucketWriter.java:323)
        at org.apache.flume.sink.hdfs.BucketWriter$9$1.run(BucketWriter.java:701)
        at org.apache.flume.auth.SimpleAuthenticator.execute(SimpleAuthenticator.java:50)
        at org.apache.flume.sink.hdfs.BucketWriter$9.call(BucketWriter.java:698)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        ... 1 more

我能够在水槽上找到相关的代码: https://github.com/apache/flume/blob/trunk/flume-ng-sinks/flume-hdfs-sink/src/main/java/org/apache/flume/sink/hdfs/BucketWriter.java(行:602)

// write the event
try {
  sinkCounter.incrementEventDrainAttemptCount();
  callWithTimeout(new CallRunner<Void>() {
    @Override
    public Void call() throws Exception {
      writer.append(event); // could block
      return null;
    }
  });
} catch (IOException e) {
  LOG.warn("Caught IOException writing to HDFSWriter ({}). Closing file (" +
      bucketPath + ") and rethrowing exception.",
      e.getMessage());
  close(true);
  throw e;
}

错误:Caught IOException writing to HDFSWriter (no protocol: value). Closing file

我无法锻炼错误no protocol: value的含义。

在与Flume和HDFS有关的任何上下文中,我都找不到与该错误有关的任何引用。

1 个答案:

答案 0 :(得分:1)

配置中缺少Incerceptor协议-在水槽配置文件中添加了“ file:/”,可解决此问题。

类似的问题参考:https://community.cloudera.com/t5/Data-Ingestion-Integration/Flume-HDFS-sink-error-quot-unknown-protocol-hdfs-quot/td-p/19344