Flume 監控目錄檔案 spooldir

2021-08-03 12:32:02 字數 1708 閱讀 5543

flume應用場景中監控某個目錄下的檔案進行讀取使用的很多,flume通過source型別為spooldir來進行監控目錄下檔案,當新增檔案時,flume可將檔案進行讀取,開發者只需要編寫對應的檔案序列化器即可將讀取的檔案轉存至hbase、hdfs、或者其他希望的資料格式。
test_agent.sources  = test_source

test_agent.channels = test_channel

test_agent.sinks = test_sink

#設定source型別為監控目錄型別

test_agent.sources

.test_source.type = spooldir

#對應的channel名稱

test_agent.sources

.test_source.channels = test_channel

#要監控的目錄

test_agent.sources

.test_source.spooldir = /data/kafka_test_data/ad/flume_test_channel

test_agent.sources

.test_source.deserializer

.maxlinelength = 10000

#設定channel型別為記憶體

test_agent.channels

.test_channel.type = memory

test_agent.channels

.test_channel.capacity = 100000

test_agent.channels

.test_channel.transactioncapacity = 100000

#自定義的flume sink

test_agent.sinks

.test_sink.type = com

.test

.cdh

.flume

.sink

.hbase

.testhbasesink

#最終儲存的資料格式為hbase

test_agent.sinks

.test_sink.znodeparent = /hbase

#hbase所需要的zookeeper位址列表

test_agent.sinks

.test_sink.zookeeperquorum = mimo42:2181,mimo43:2181,mimo44:2181

#自定義序列化器

test_agent.sinks

.test_sink.serializer = com

.test

.cdh

.flume

.sink

.hbase

.serializer

.testhbaseeventserializer

#對應的channel名稱

test_agent.sinks

.test_sink.channel = test_channel

test_agent.sinks

.test_sink.batchsize = 1000

#用來表明是否為安全模式

test_agent.sinks

.test_sink.safemode=true

flume監控目錄檔案到hdfs

agent1 name agent1.sources source1 agent1.sinks sink1 agent1.channels channel1 spooling directory set source1 agent1.sources source1.type spooldir age...

Flume1 9 0實時監控目錄下多個新檔案

1.案例需求 使用flume監聽整個目錄的檔案,並上傳至hdfs 2.實現步驟 1 建立配置檔案flume dir hdfs.conf 建立乙個檔案 nogc hadoop102 job vim flume dir hdfs.conf新增如下內容 a3.sources r3 a3.sinks k3 ...

Flume對接Kafka,Kafka監控

1 配置flume flume kafka.conf definea1.sources r1a1.sinks k1a1.channels c1 sourcea1.sources.r1.type execa1.sources.r1.command tail f c 0 opt module datas...