# Describe the sink 配置Agent的sink a1.sinks.k1.type = logger
# Use a channel which buffers events in memory 配置Agent的channel a1.channels.c1.type = memory a1.channels.c1.capacity = 1000 a1.channels.c1.transactionCapacity = 100
# Bind the source and sink to the channel 配置source连接channel和channel连接sink a1.sources.r1.channels = c1 a1.sinks.k1.channel = c1
[hadoop@bigdata01 flume-1.6.0-cdh5.16.2-bin]$ bin/flume-ng Error: Unknown or unspecified command ''
Usage: bin/flume-ng <command> [options]...
commands: help display this help text agent run a Flume agent avro-client run an avro Flume client version show Flume version info
global options: --conf,-c <conf> use configs in <conf> directory --classpath,-C <cp> append to the classpath --dryrun,-d do not actually start Flume, just print the command --plugins-path <dirs> colon-separated list of plugins.d directories. See the plugins.d section in the user guide for more details. Default: $FLUME_HOME/plugins.d -Dproperty=value sets a Java system property value -Xproperty=value sets a Java -X option
agent options: --name,-n <name> the name of thisagent(required) --conf-file,-f <file> specify a config file(required if -z missing) --zkConnString,-z <str> specify the ZooKeeper connection to use(required if -f missing) --zkBasePath,-p <path> specify the base path in ZooKeeper for agent configs --no-reload-conf do not reload config file if changed --help,-h display help text
a1.channels.c1.type = memory <===channel 的类型 a1.channels.c1.capacity = 10000 <===channel 中能存储的Event的最大个数 a1.channels.c1.transactionCapacity = 10000 <===channel 传递的一个批次的最大Event个数 a1.channels.c1.byteCapacityBufferPercentage = 20 <===the percent of buffer between byteCapacity and the estimated total size of all events in the channel, to account for data in headers.
# Describe the sink 配置Agent的sink a1.sinks.k1.type = hdfs a1.sinks.k1.hdfs.path = hdfs://bigdata01:9000/flume/events a1.sinks.k1.hdfs.filePrefix = bigdata- a1.sinks.k1.hdfs.fileType = DataStream a1.sinks.k1.hdfs.writeFormat = Text
# Use a channel which buffers events in memory 配置Agent的channel a1.channels.c1.type = memory a1.channels.c1.capacity = 1000 a1.channels.c1.transactionCapacity = 100
# Bind the source and sink to the channel 配置source连接channel和channel连接sink a1.sources.r1.channels = c1 a1.sinks.k1.channel = c1
# Use a channel which buffers events in memory 配置Agent的channel a1.channels.c1.type = memory a1.channels.c1.capacity = 1000 a1.channels.c1.transactionCapacity = 100
# Bind the source and sink to the channel 配置source连接channel和channel连接sink a1.sources.r1.channels = c1 a1.sinks.k1.channel = c1
2017-12-1420:36:04,867 (pool-5-thread-1) [INFO - org.apache.flume.client.avro.ReliableSpoolingFileEventReader.readEvents(ReliableSpoolin gFileEventReader.java:324)] Last read took us just up to a file boundary. Rolling to the next file, if there is one. 2017-12-1420:36:04,868 (pool-5-thread-1) [INFO - org.apache.flume.client.avro.ReliableSpoolingFileEventReader.rollCurrentFile(ReliableSp oolingFileEventReader.java:433)] Preparing to move file /home/hadoop/data/flumeData/spool/word.log to /home/hadoop/data/flumeData/spool/word.log.COMPLETED 2017-12-1420:36:04,877 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.hdfs.HDFSDataStream.configure(HDFSDataStream.java:57)] Serializer = TEXT, UseRawLocalFileSystem = false 2017-12-1420:36:05,146 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.hdfs.BucketWriter.open(BucketWriter.java:246)] Creating hdfs://bigdata01:9000/flume/spoool/202002142036/bigdata-.1581683764877.tmp 2017-12-1420:36:05,285 (hdfs-k1-call-runner-0) [WARN - org.apache.hadoop.util.NativeCodeLoader.<clinit>(NativeCodeLoader.java:62)] Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 2017-12-1420:36:06,582 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.hdfs.BucketWriter.doClose(BucketWriter.java:438)] Closing hdfs://bigdata01:9000/flume/spoool/202002142036/bigdata-.1581683764877.tmp 2017-12-1420:36:06,598 (hdfs-k1-call-runner-3) [INFO - org.apache.flume.sink.hdfs.BucketWriter$7.call(BucketWriter.java:681)] Renaming hdfs://bigdata01:9000/flume/spoool/202002142036/bigdata-.1581683764877.tmp to hdfs://bigdata01:9000/flume/spoool/202002142036/bigdata-.1581683764877
# Describe the sink 配置Agent的sink a1.sinks.k1.type = logger
# Use a channel which buffers events in memory 配置Agent的channel a1.channels.c1.type = memory a1.channels.c1.capacity = 1000 a1.channels.c1.transactionCapacity = 100
# Bind the source and sink to the channel 配置source连接channel和channel连接sink a1.sources.r1.channels = c1 a1.sinks.k1.channel = c1
2017-12-1423:14:13,824 (SinkRunner-PollingRunner-DefaultSinkProcessor) [ERROR - org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:158)] Unable to deliver event. Exception follows. org.apache.flume.EventDeliveryException: java.lang.NullPointerException: Expected timestamp in the Flume event headers, but it was null at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:449) 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: Expected timestamp in the Flume event headers, but it was null at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204) at org.apache.flume.formatter.output.BucketPath.replaceShorthand(BucketPath.java:251) at org.apache.flume.formatter.output.BucketPath.escapeString(BucketPath.java:460) at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:366) ... 3 more
# Describe the sink 配置Agent的sink a1.sinks.k1.type = logger
# Use a channel which buffers events in memory 配置Agent的channel a1.channels.c1.type = memory a1.channels.c1.capacity = 1000 a1.channels.c1.transactionCapacity = 100
# Bind the source and sink to the channel 配置source连接channel和channel连接sink a1.sources.r1.channels = c1 a1.sinks.k1.channel = c1