輔助系統 flume

2021-08-30 02:31:53 字數 2964 閱讀 7869

進入conf資料夾

增加配置檔案

[hadoop@linux1 conf]$ vi netcat-logger.conf

# example.conf: a single-node flume configuration

# name the components on this agent

#給那三個元件取個名字

a1.sources = r1

a1.sinks = k1

a1.channels = c1

# describe/configure the source

#型別, 從網路埠接收資料,在本機啟動, 所以localhost, type=spooldir採集目錄源,目錄裡有就採

a1.sources.r1.type = netcat

a1.sources.r1.bind = localhost

a1.sources.r1.port = 44444

# describe the sink

a1.sinks.k1.type = logger

# use a channel which buffers events in memory

#下沉的時候是一批一批的, 下沉的時候是乙個個eventchannel引數解釋:

#capacity:預設該通道中最大的可以儲存的event數量

#trasactioncapacity:每次最大可以從source中拿到或者送到sink中的event數量

a1.channels.c1.type = memory

a1.channels.c1.capacity = 1000

a1.channels.c1.transactioncapacity = 100

# bind the source and sink to the channel

a1.sources.r1.channels = c1

a1.sinks.k1.channel = c1

啟動命令:

#告訴flum啟動乙個agent,指定配置引數, --name:agent的名字,

在另乙個視窗傳入資料:

$ telnet localhost 44444

trying 127.0.0.1...

connected to localhost.localdomain (127.0.0.1).

escape character is '^]'.

hello world!

oktelnet的安裝

yum list telnet*               列出telnet相關的安裝包

yum install telnet-server 安裝telnet服務

yum install telnet.* 安裝telnet客戶端

日誌採集
[hadoop@linux1 conf]$ vi tail-hdfs.conf 

# name the components on this agent

a1.sources = r1

a1.sinks = k1

a1.channels = c1

# describe/configure the source

a1.sources.r1.type = exec

a1.sources.r1.command = tail -f /home/hadoop/log/test.log

a1.sources.r1.channels = c1

# describe the sink

a1.sinks.k1.type = hdfs

a1.sinks.k1.channel = c1

a1.sinks.k1.hdfs.path = /flume/events/%y-%m-%d/%h%m/

a1.sinks.k1.hdfs.fileprefix = events-

a1.sinks.k1.hdfs.round = true

a1.sinks.k1.hdfs.roundvalue = 10

a1.sinks.k1.hdfs.roundunit = minute

a1.sinks.k1.hdfs.rollinterval = 3

a1.sinks.k1.hdfs.rollsize = 20

a1.sinks.k1.hdfs.rollcount = 5

a1.sinks.k1.hdfs.batchsize = 1

a1.sinks.k1.hdfs.uselocaltimestamp = true

#生成的檔案型別,預設是sequencefile,可用datastream,則為普通文字

a1.sinks.k1.hdfs.filetype = datastream

# use a channel which buffers events in memory

a1.channels.c1.type = memory

a1.channels.c1.capacity = 1000

a1.channels.c1.transactioncapacity = 100

# bind the source and sink to the channel

a1.sources.r1.channels = c1

a1.sinks.k1.channel = c1

檢查是否有日誌目錄

touch /home/hadoop/log/test.log

mkdir /home/hadoop/log/

模擬日誌

[hadoop@linux1 ~]$ while true; do echo 12321312321321 >> /home/hadoop/log/test.log; sleep 0.5; done

用tail命令獲取資料,下沉到hdfs

啟動命令:

flume (日誌收集系統)

flume 日誌收集系統 flume是cloudera提供的乙個高可用的,高可靠的,分布式的海量日誌採集 聚合和傳輸的系統,flume支援在日誌系統中定製各類資料傳送方,用於收集資料 同時,flume提供對資料進行簡單處理,並寫到各種資料接受方 可定製 的能力。當前flume有兩個版本flume 0...

flume(日誌收集系統)

flume 日誌收集系統 flume是cloudera提供的乙個高可用的,高可靠的,分布式的海量日誌採集 聚合和傳輸的系統,flume支援在日誌系統中定製各類資料傳送方,用於收集資料 同時,flume提供對資料進行簡單處理,並寫到各種資料接受方 可定製 的能力。當前flume有兩個版本flume 0...

windows系統flume資料傳給kafka

1 安裝zookeeper 更改flume配置為kafka b.編輯系統變數中的path變數,增加 zookeeper home bin conf 新增檔案 zoo.cfg the number of milliseconds of each tick 心跳間隔 毫秒每次 ticktime 2000...