集群环境:CDH 6.2.0
Hadoop 3.0.0
在使用flume hdfs sink时 报错,java.lang.NoSuchFieldError: IGNORE_CLIENT_LOCALITY
flume sink在相应目录下创建了.tmp文件,但无法写入数据
2020-03-16 18:32:44,757 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.hdfs.BucketWriter.open(BucketWriter.java:246)] Creating /user/spark/maidian/behavior_output/interceptor_test/20200316/03/interceptor-memory-channel-.1584354764737.tmp
2020-03-16 18:32:46,130 (SinkRunner-PollingRunner-DefaultSinkProcessor) [ERROR - org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:459)] process failed
java.lang.NoSuchFieldError: IGNORE_CLIENT_LOCALITYat org.apache.hadoop.hdfs.DFSOutputStream.<init>(DFSOutputStream.java:204)at org.apache.hadoop.hdfs.DFSOutputStream.<init>(DFSOutputStream.java:247)at org.apache.hadoop.hdfs.DFSOutputStream.newStreamForCreate(DFSOutputStream.java:313)at org.apache.hadoop.hdfs.DFSClient.create(DFSClient.java:1176)at org.apache.hadoop.hdfs.DFSClient.create(DFSClient.java:1155)at org.apache.hadoop.hdfs.DFSClient.create(DFSClient.java:1093)at org.apache.hadoop.hdfs.DistributedFileSystem$8.doCall(DistributedFileSystem.java:463)at org.apache.hadoop.hdfs.DistributedFileSystem$8.doCall(DistributedFileSystem.java:460)at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)at org.apache.hadoop.hdfs.DistributedFileSystem.create(DistributedFileSystem.java:474)at org.apache.hadoop.hdfs.DistributedFileSystem.create(DistributedFileSystem.java:401)at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1103)at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:1083)at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:972)at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:960)at org.apache.flume.sink.hdfs.HDFSDataStream.doOpen(HDFSDataStream.java:81)at org.apache.flume.sink.hdfs.HDFSDataStream.open(HDFSDataStream.java:108)at org.apache.flume.sink.hdfs.BucketWriter$1.call(BucketWriter.java:257)at org.apache.flume.sink.hdfs.BucketWriter$1.call(BucketWriter.java:247)at org.apache.flume.sink.hdfs.BucketWriter$8$1.run(BucketWriter.java:727)at java.security.AccessController.doPrivileged(Native Method)at javax.security.auth.Subject.doAs(Subject.java:422)at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1962)at org.apache.flume.auth.UGIExecutor.execute(UGIExecutor.java:46)at org.apache.flume.auth.KerberosAuthenticator.execute(KerberosAuthenticator.java:64)at org.apache.flume.sink.hdfs.BucketWriter$8.call(BucketWriter.java:724)at java.util.concurrent.FutureTask.run(FutureTask.java:266)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)at java.lang.Thread.run(Thread.java:748)
Exception in thread "SinkRunner-PollingRunner-DefaultSinkProcessor" java.lang.NoSuchFieldError: IGNORE_CLIENT_LOCALITY
百度各种无果,凭感觉是jar包问题
将flume /lib下的hadoop-common-3.0.0.jar 替换成 hadoop-common-3.0.0-cdh6.2.0.jar 问题解决