1. Where the error is
.-Geneva- + Geneva: at: to,508(pool-3-thread-1) [Error-org.apache.flume.source.spooldirectorysource$spooldirectoryrunnable.run (SpoolDirectorySource.java: the)] Fatal:spool Directory source source1: {spooldir:/home/hadoop_admin/movielog/}: Uncaught exceptioninchSpooldirectorysource Thread. Restart or reconfigure Flume to continue processing.java.nio.charset.MalformedInputException:Input length=1At java.nio.charset.CoderResult.throwException (Coderresult.java:277) at Org.apache.flume.serialization.ResettableFileInputStream.readChar (Resettablefileinputstream.java:195) at Org.apache.flume.serialization.LineDeserializer.readLine (Linedeserializer.java:134) at Org.apache.flume.serialization.LineDeserializer.readEvent (Linedeserializer.java: the) at Org.apache.flume.serialization.LineDeserializer.readEvents (Linedeserializer.java: the) at Org.apache.flume.client.avro.ReliableSpoolingFileEventReader.readEvents ( Reliablespoolingfileeventreader.java:238) at Org.apache.flume.source.spooldirectorysource$spooldirectoryrunnable.run (Spooldirectorysource.java:227) at Java.util.concurrent.executors$runnableadapter.call (Executors.java:471) at Java.util.concurrent.FutureTask.runAndReset (Futuretask.java:304) at java.util.concurrent.scheduledthreadpoolexecutor$scheduledfuturetask.access$301(Scheduledthreadpoolexecutor.java:178) at Java.util.concurrent.scheduledthreadpoolexecutor$scheduledfuturetask.run ( Scheduledthreadpoolexecutor.java:293) at Java.util.concurrent.ThreadPoolExecutor.runWorker (Threadpoolexecutor.java:1145) at Java.util.concurrent.threadpoolexecutor$worker.run (Threadpoolexecutor.java:615) at Java.lang.Thread.run (Thread.java:745)
2. Workaround
The default value of the Inputcharset property of the reason is UTF-8, but the character set of the log file being read is GBK, so changing this property value is possible.
Agent1.sources =Source1agent1.channels=channel1agent1.sinks=sink1# for each one of the sources, the type is Definedagent1.sources.source1.type=Spooldiragent1.sources.source1.spoolDir=/home/hadoop_admin/movielog/Agent1.sources.source1.inputCharset=GBKagent1.sources.source1.fileHeader=trueAgent1.sources.source1.deletePolicy=immediateagent1.sources.source1.batchSize= +Agent1.sources.source1.channels=channel1# each sink's type must be definedAgent1.sinks.sink1.type =Hdfsagent1.sinks.sink1.hdfs.path= HDFs://master:9000/flumetestAgent1.sinks.sink1.hdfs.filePrefix = master-Agent1.sinks.sink1.hdfs.writeFormat=Textagent1.sinks.sink1.hdfs.fileType=DataStreamagent1.sinks.sink1.hdfs.rollInterval=0agent1.sinks.sink1.hdfs.rollSize=10240agent1.sinks.sink1.hdfs.batchSize= -Agent1.sinks.sink1.hdfs.callTimeout=30000Agent1.sinks.sink1.channel=channel1# each channel's type is defined.Agent1.channels.channel1.type =memoryagent1.channels.channel1.capacity=100000agent1.channels.channel1.transactionCapacity=100000Agent1.channels.channel1.keep-alive = -
Flume Character set error when using spool source