Bootstrap

Flume写入HDFS报错

ERROR [SinkRunner-PollingRunner-DefaultSinkProcessor] org.apache.flume.sink.hdfs.HDFSEventSink - process failed
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
        at org.apache.hadoop.conf.Configuration.set(Configuration.java:1357) ~[hadoop-common-3.1.3.jar:?]
        at org.apache.hadoop.conf.Configuration.set(Configuration.java:1338) ~[hadoop-common-3.1.3.jar:?]
        at org.apache.hadoop.conf.Configuration.setBoolean(Configuration.java:1679) ~[hadoop-common-3.1.3.jar:?]
        at org.apache.flume.sink.hdfs.BucketWriter.open(BucketWriter.java:221) ~[flume-hdfs-sink-1.11.0.jar:1.11.0]
        at org.apache.flume.sink.hdfs.BucketWriter.append(BucketWriter.java:572) ~[flume-hdfs-sink-1.11.0.jar:1.11.0]
        at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:410) ~[flume-hdfs-sink-1.11.0.jar:1.11.0]
        at org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:39) ~[flume-ng-core-1.11.0.jar:1.11.0]
        at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:145) ~[flume-ng-core-1.11.0.jar:1.11.0]
        at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_361]
Exception in thread "SinkRunner-PollingRunner-DefaultSinkProcessor" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
        at org.apache.hadoop.conf.Configuration.set(Configuration.java:1357)
        at org.apache.hadoop.conf.Configuration.set(Configuration.java:1338)
        at org.apache.hadoop.conf.Configuration.setBoolean(Configuration.java:1679)
        at org.apache.flume.sink.hdfs.BucketWriter.open(BucketWriter.java:221)
        at org.apache.flume.sink.hdfs.BucketWriter.append(BucketWriter.java:572)
        at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:410)
        at org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:39)
        at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:145)
        at java.lang.Thread.run(Thread.java:750)

这个报错说明hadoop的auava.jar包与flume的不同

1.删除低版本的jar包(这里我的是flume版本低)

rm /opt/server/flume/lib/guava-11.0.2.jar

2.将高版本的jar复制到flume中

cp /opt/server/hadoop/share/hadoop/common/lib/guava-27.0-jre.jar /opt/server/flume/lib

;