1. 程式人生 > >Flume叢集安裝配置

Flume叢集安裝配置

軟體準備:apache-flume-1.8.0-bin.tar.gz
環境需求:3臺虛擬機器ssh免密登入,/etc/hosts檔案互通:
192.168.8.128 master
192.168.8.129 slave1
192.168.8.130.slave2

1.在flume/conf/下新建agent.conf檔案

#Agent
flumeAgent.channels = c1
flumeAgent.sources  = s1
flumeAgent.sinks    = k1 
#flumeAgent Spooling Directory Source
#注(1)
flumeAgent.sources.s1.type = spooldir flumeAgent.sources.s1.spoolDir =/usr/logs/ flumeAgent.sources.s1.fileHeader = true flumeAgent.sources.s1.deletePolicy =immediate flumeAgent.sources.s1.batchSize =1000 flumeAgent.sources.s1.channels =c1 flumeAgent.sources.s1.deserializer.maxLineLength =1048576 #flumeAgent FileChannel
#注(2) flumeAgent.channels.c1.type = file flumeAgent.channels.c1.checkpointDir = /var/flume/spool/checkpoint flumeAgent.channels.c1.dataDirs = /var/flume/spool/data flumeAgent.channels.c1.capacity = 200000000 flumeAgent.channels.c1.keep-alive = 30 flumeAgent.channels.c1.write-timeout = 30 flumeAgent.channels.c1.checkpoint
-timeout=600 # flumeAgent Sinks #注(3) flumeAgent.sinks.k1.channel = c1 flumeAgent.sinks.k1.type = avro # connect to CollectorMainAgent flumeAgent.sinks.k1.hostname = 192.168.8.128 flumeAgent.sinks.k1.port = 44444

2.設定128Master機器為匯聚節點,129和130的日誌檔案都將集中到這裡,在flume/conf/下新建consolidation.conf檔案,配置如下:

#flumeConsolidationAgent
flumeConsolidationAgent.channels = c1
flumeConsolidationAgent.sources  = s1
flumeConsolidationAgent.sinks    = k1 

#flumeConsolidationAgent Avro Source
#注(4)
flumeConsolidationAgent.sources.s1.type = avro
flumeConsolidationAgent.sources.s1.channels = c1
flumeConsolidationAgent.sources.s1.bind = 192.168.8.128
flumeConsolidationAgent.sources.s1.port = 44444

#flumeConsolidationAgent FileChannel
flumeConsolidationAgent.channels.c1.type = file
flumeConsolidationAgent.channels.c1.checkpointDir = /var/flume/spool/checkpoint
flumeConsolidationAgent.channels.c1.dataDirs = /var/flume/spool/data
flumeConsolidationAgent.channels.c1.capacity = 200000000
flumeConsolidationAgent.channels.c1.keep-alive = 30
flumeConsolidationAgent.channels.c1.write-timeout = 30
flumeConsolidationAgent.channels.c1.checkpoint-timeout=600

##flumeConsolidationAgent Memory Channel
#flumeConsolidationAgent.channels.c1.type = memory
#flumeConsolidationAgent.channels.c1.capacity = 10000
#flumeConsolidationAgent.channels.c1.transactionCapacity = 10000
#flumeConsolidationAgent.channels.c1.byteCapacityBufferPercentage = 20
#flumeConsolidationAgent.channels.c1.byteCapacity = 800000

#flumeConsolidationAgent Sinks
#注(5)
flumeConsolidationAgent.sinks.k1.channel= c1
flumeConsolidationAgent.sinks.k1.type = file_roll
flumeConsolidationAgent.sinks.k1.sink.directory = /var/tmp
flumeConsolidationAgent.sinks.k1.sink.rollInterval = 3600
flumeConsolidationAgent.sinks.k1.batchSize = 10000
scp flume-1.8.0 slave1:/root/bigdata/flume-1.8.0
scp flume-1.8.0 slave2:/root/bigdata/flume-1.8.0

3.所有上述置完成後,先啟動107,命令列:

 bin/flume-ng agent --conf conf --conf-file conf/consolidation.conf --name flumeConsolidationAgent -Dflume.root.logger=DEBUG,console

4.再啟動129和130,命令列:

bin/flume-ng agent --conf conf --conf-file conf/agent.conf --name flumeAgent -Dflume.root.logger=DEBUG,console

最後,如下圖所示,標識成功
這裡寫圖片描述