
vim flume-dir-hdfs.confa3.sources = r3a3.sinks = k3a3.channels = c3# Describe/configure the source#source类型a3.sources.r3.type = spooldir#监控的路径a3.sources.r3.spoolDir = /opt/egg/apache-flume-1.7.0-bin/upload#定义文件上传完后生成的后缀(linux 的文件上传完会加这个后缀)a3.sources.r3.fileSuffix = .COMPLETED#是否有文件头a3.sources.r3.fileHeader = true#忽略所有以.tmp结尾的文件,不上传a3.sources.r3.ignorePattern = ([^ ]*\.tmp)# Describe the sinka3.sinks.k3.type = hdfsa3.sinks.k3.hdfs.path = hdfs://hadoop1:9000/flume/upload/%Y%m%d/%H#上传文件的前缀a3.sinks.k3.hdfs.filePrefix = upload-#是否按照时间滚动文件夹a3.sinks.k3.hdfs.round = true#多少时间单位创建一个新的文件夹a3.sinks.k3.hdfs.roundValue = 1#重新定义时间单位a3.sinks.k3.hdfs.roundUnit = hour#是否使用本地时间戳a3.sinks.k3.hdfs.useLocalTimeStamp = true#积攒多少个Event才flush到HDFS一次a3.sinks.k3.hdfs.batchSize = 100#设置文件类型,可支持压缩a3.sinks.k3.hdfs.fileType = DataStream#多久生成一个新的文件a3.sinks.k3.hdfs.rollInterval = 60#设置每个文件的滚动大小大概是128Ma3.sinks.k3.hdfs.rollSize = 134217700#文件的滚动与Event数量无关a3.sinks.k3.hdfs.rollCount = 0# Use a channel which buffers events in memorya3.channels.c3.type = memorya3.channels.c3.capacity = 1000a3.channels.c3.transactionCapacity = 100# Bind the source and sink to the channela3.sources.r3.channels = c3a3.sinks.k3.channel = c3运行flumebin/flume-ng agent --conf conf/ --name a3 --conf-file job/flume-dir-hdfs.conf实验往目录touch文件 包括tmp结尾的和txt结尾的echo "hha" > log3.logecho "haha" > log4.tmpdrwxr-xr-x - root supergroup 0 2019-09-01 16:19 /flume/uploaddrwxr-xr-x - root supergroup 0 2019-09-01 16:19 /flume/upload/20190901drwxr-xr-x - root supergroup 0 2019-09-01 16:20 /flume/upload/20190901/16-rw-r--r-- 3 root supergroup 8 2019-09-01 16:20 /flume/upload/20190901/16/upload-.1567325951362