1 下載Flume
Welcome to Apache Flume — Apache Flume
下載1.9.0版本
2 上傳服務器并解壓安裝
3 刪除lib目錄下的guava-11.0.2.jar (如同服務器安裝了hadoop,則刪除,如沒有安裝hadoop則保留這個文件,否則無法啟動flume)
4 修改conf下的log4j.properties文件
flume.root.logger=INFO,LOGFILE,console
flume.log.dir=/usr/local/flume-1.9.0/logs
5 測試
安裝netcat?
yum install nc
根目錄下創建job目錄,目錄下新建 nc-flume-console.conf,將netcat輸入的內容通過flume收集,并通過console打印在控制臺
# 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
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
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
執行命令
bin/flume-ng agent -c conf/ -f job/nc-flume-console.conf -n a1
另外開一個窗口執行
nc localhost 44444
在窗口中輸入內容,在flume控制臺打印說明安裝成功