Flume監聽資料夾的變動 03

2021-09-19 19:02:38 字數 2929 閱讀 1863

#把agent起個名叫a3,sources叫r3,sinks叫k3.hdfs,channels叫c3

a3.sources = r3

a3.sinks = k3

a3.channels = c3

# describe/configure the source

a3.sources.r3.type = spooldir

a3.sources.r3.spooldir = /opt/modules/apache-flume-1.5.0-cdh5.3.6-bin/upload

a3.sources.r3.fileheader = true

#忽略所有以.tmp結尾的檔案,不上傳

a3.sources.r3.ignorepattern = ([^ ]*\.tmp)

# describe the sink

a3.sinks.k3.type = hdfs

a3.sinks.k3.hdfs.path = hdfs:

#上傳檔案的字首

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 = 1000

#設定檔案型別,可支援壓縮

a3.sinks.k3.hdfs.filetype = datastream

#多久生成乙個新的檔案

a3.sinks.k3.hdfs.rollinterval = 600

#設定每個檔案的滾動大小

a3.sinks.k3.hdfs.rollsize = 134217700

#檔案的滾動與event數量無關

a3.sinks.k3.hdfs.rollcount = 0

#最小冗餘數

03 flume監聽資料夾並將檔案上傳到HDFS

我們已經了解了使用flume監聽埠以及檔案內容,本節將展示使用flume去監聽乙個資料夾並且上傳其中的檔案到hdfs。a1.sources r1 a1.sinks k1 a1.channels c1 describe configure the source a1.sources.r1.type s...

flume的檔案跟蹤配置 資料夾 hdfs

1.建立配置檔案 vim dir hdfs.conf spooldir flume中自帶的讀取目錄的source,只要出現新檔案就會被讀走 定義三大元件的名稱 ag1.sources source1 ag1.sinks sink1 ag1.channels channel1 配置source元件 a...

springboot 監聽檔案和資料夾改動

專案中有需要監聽檔案 資料夾的需求,以便在檔案 資料夾發生變化時出發相應的業務流程。這裡使用spring boot apache commons io方案。另外,apache commons io涉及到多執行緒的應用,專案中應指定執行緒池的相關配置,參考spring boot 執行緒池配置。1.設定...