flume java.lang.IllegalArgumentException: Timestamp must be positive

报错:

java.lang.IllegalArgumentException: Timestamp must be positive
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:88)
        at org.apache.flume.tools.TimestampRoundDownUtil.roundDownField(TimestampRoundDownUtil.java:88)
        at org.apache.flume.tools.TimestampRoundDownUtil.roundDownTimeStampMinutes(TimestampRoundDownUtil.java:58)
        at org.apache.flume.formatter.output.BucketPath.roundDown(BucketPath.java:346)
        at org.apache.flume.formatter.output.BucketPath.replaceShorthand(BucketPath.java:242)
        at org.apache.flume.formatter.output.BucketPath.escapeString(BucketPath.java:432)
        at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:380)
        at org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:68)
        at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:147)
        at java.lang.Thread.run(Thread.java:745)
02 Mar 2020 14:42:19,819 ERROR [SinkRunner-PollingRunner-DefaultSinkProcessor] (org.apache.flume.SinkRunner$PollingRunner.run:160)  - Unable to deliver event. Exception follows.
org.apache.flume.EventDeliveryException: java.lang.IllegalArgumentException: Timestamp must be positive
        at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:463)
        at org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:68)
        at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:147)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Timestamp must be positive
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:88)
        at org.apache.flume.tools.TimestampRoundDownUtil.roundDownField(TimestampRoundDownUtil.java:88)
        at org.apache.flume.tools.TimestampRoundDownUtil.roundDownTimeStampMinutes(TimestampRoundDownUtil.java:58)
        at org.apache.flume.formatter.output.BucketPath.roundDown(BucketPath.java:346)
        at org.apache.flume.formatter.output.BucketPath.replaceShorthand(BucketPath.java:242)
        at org.apache.flume.formatter.output.BucketPath.escapeString(BucketPath.java:432)
        at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:380)
        ... 3 more
02 Mar 2020 14:42:24,821 ERROR [SinkRunner-PollingRunner-DefaultSinkProcessor] (org.apache.flume.sink.hdfs.HDFSEventSink.process:459)  - process failed
java.lang.IllegalArgumentException: Timestamp must be positive
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:88)
        at org.apache.flume.tools.TimestampRoundDownUtil.roundDownField(TimestampRoundDownUtil.java:88)
        at org.apache.flume.tools.TimestampRoundDownUtil.roundDownTimeStampMinutes(TimestampRoundDownUtil.java:58)
        at org.apache.flume.formatter.output.BucketPath.roundDown(BucketPath.java:346)
        at org.apache.flume.formatter.output.BucketPath.replaceShorthand(BucketPath.java:242)
        at org.apache.flume.formatter.output.BucketPath.escapeString(BucketPath.java:432)
        at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:380)
        at org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:68)
        at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:147)
        at java.lang.Thread.run(Thread.java:745)

原因:

       kafka生产者没有提供 时间戳。

解决:

一、修改flume配置文件

添加:k2h.sinks.k1.hdfs.useLocalTimeStamp=true

二、kafka 生产者添加时间戳

new ProducerRecord<String, String>(topic,null,System.currentTimeMillis(), UUID.randomUUID().toString(), messageStr)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值