Flume:spark-project專案的flume配置

花和尚也有春天發表於2018-09-18

1、將flume-ng-1.5.0-cdh5.3.6.tar.gz使用WinSCP拷貝到sparkproject1的/usr/local目錄下。

2、對flume進行解壓縮:tar -zxvf flume-ng-1.5.0-cdh5.3.6.tar.gz

3、對flume目錄進行重新命名:mv apache-flume-1.5.0-cdh5.3.6-bin flume

4、配置scala相關的環境變數

vi ~/.bashrc

export FLUME_HOME=/usr/local/flume

export FLUME_CONF_DIR=$FLUME_HOME/conf

export PATH=$FLUME_HOME/bin

source ~/.bashrc

 

vi /usr/local/flume/conf/flume-conf.properties

#agent1表示代理名稱

agent1.sources=source1

agent1.sinks=sink1

agent1.channels=channel1

#配置source1 agent1.sources.source1.type=spooldir

agent1.sources.source1.spoolDir=/usr/local/logs     //設定監控的資料夾

agent1.sources.source1.channels=channel1

agent1.sources.source1.fileHeader = false

agent1.sources.source1.interceptors = i1

agent1.sources.source1.interceptors.i1.type = timestamp

#配置channel1

agent1.channels.channel1.type=file

agent1.channels.channel1.checkpointDir=/usr/local/logs_tmp_cp

agent1.channels.channel1.dataDirs=/usr/local/logs_tmp

#配置sink1

agent1.sinks.sink1.type=hdfs

agent1.sinks.sink1.hdfs.path=hdfs://sparkproject1:9000/logs  //監控日誌寫入到hdfs

agent1.sinks.sink1.hdfs.fileType=DataStream

agent1.sinks.sink1.hdfs.writeFormat=TEXT

agent1.sinks.sink1.hdfs.rollInterval=1

agent1.sinks.sink1.channel=channel1

agent1.sinks.sink1.hdfs.filePrefix=%Y-%m-%d

 

 

 

相關文章