Flume入門教程

1. Flume 介紹

1.1. 概述

  • Flume是一個分布式、可靠、和高可用的海量日志采集、聚合和傳輸?shù)南到y(tǒng)。
  • Flume可以采集文件,socket數(shù)據(jù)包、文件、文件夾、kafka等各種形式源數(shù)據(jù),又可以將采集到的數(shù)據(jù)(下沉sink)輸出到HDFS、hbase、hive、kafka等眾多外部存儲系統(tǒng)中
  • 一般的采集需求,通過對flume的簡單配置即可實現(xiàn)
  • Flume針對特殊場景也具備良好的自定義擴(kuò)展能力,
    因此,flume可以適用于大部分的日常數(shù)據(jù)采集場景

1.2. 運行機(jī)制

  1. Flume分布式系統(tǒng)中最核心的角色是agent,flume采集系統(tǒng)就是由一個個agent所連接起來形成
  2. 每一個agent相當(dāng)于一個數(shù)據(jù)傳遞員,內(nèi)部有三個組件:
    1. Source:采集組件,用于跟數(shù)據(jù)源對接,以獲取數(shù)據(jù)
    2. Sink:下沉組件,用于往下一級agent傳遞數(shù)據(jù)或者往最終存儲系統(tǒng)傳遞數(shù)據(jù)
    3. Channel:傳輸通道組件,用于從source將數(shù)據(jù)傳遞到sink


      image.png

1.3. Flume 結(jié)構(gòu)圖

簡單結(jié)構(gòu)

單個 Agent 采集數(shù)據(jù)

image.png
復(fù)雜結(jié)構(gòu)

多級 Agent 之間串聯(lián)

image.png

2. Flume 實戰(zhàn)案例

案例:使用網(wǎng)絡(luò)telent命令向一臺機(jī)器發(fā)送一些網(wǎng)絡(luò)數(shù)據(jù),然后通過flume采集網(wǎng)絡(luò)端口數(shù)據(jù)

image.png

2.1. Flume 的安裝部署

Step 1: 下載解壓修改配置文件

下載地址:

http://archive.apache.org/dist/flume/1.8.0/apache-flume-1.8.0-bin.tar.gz

Flume的安裝非常簡單,只需要解壓即可,當(dāng)然,前提是已有hadoop環(huán)境

上傳安裝包到數(shù)據(jù)源所在節(jié)點上

這里我們采用在第三臺機(jī)器來進(jìn)行安裝

cd /export/softwares/
tar -zxvf apache-flume-1.8.0-bin.tar.gz -C ../servers/
cd /export/servers/apache-flume-1.8.0-bin/conf
cp  flume-env.sh.template flume-env.sh
vim flume-env.sh
export JAVA_HOME=/export/servers/jdk1.8.0_141
Step 2: 開發(fā)配置文件

根據(jù)數(shù)據(jù)采集的需求配置采集方案,描述在配置文件中(文件名可任意自定義)

配置我們的網(wǎng)絡(luò)收集的配置文件
在flume的conf目錄下新建一個配置文件(采集方案)

vim   /export/servers/apache-flume-1.8.0-bin/conf/netcat-logger.conf
# 定義這個agent中各組件的名字
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# 描述和配置source組件:r1
a1.sources.r1.type = netcat
a1.sources.r1.bind = 192.168.174.
a1.sources.r1.port = 44444

# 描述和配置sink組件:k1
a1.sinks.k1.type = logger

# 描述和配置channel組件,此處使用是內(nèi)存緩存的方式
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# 描述和配置source  channel   sink之間的連接關(guān)系
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
Step 3: 啟動配置文件

指定采集方案配置文件,在相應(yīng)的節(jié)點上啟動flume agent

先用一個最簡單的例子來測試一下程序環(huán)境是否正常
啟動agent去采集數(shù)據(jù)

bin/flume-ng agent -c conf -f conf/netcat-logger.conf -n a1  -Dflume.root.logger=INFO,console
  • -c conf 指定flume自身的配置文件所在目錄
  • -f conf/netcat-logger.con 指定我們所描述的采集方案
  • -n a1 指定我們這個agent的名字
Step 4: 安裝 Telnet 準(zhǔn)備測試

在node02機(jī)器上面安裝telnet客戶端,用于模擬數(shù)據(jù)的發(fā)送

yum -y install telnet
telnet  node03  44444   # 使用telnet模擬數(shù)據(jù)發(fā)送

2.2. 采集案例

2.2.3. 采集目錄到 HDFS

需求

某服務(wù)器的某特定目錄下,會不斷產(chǎn)生新的文件,每當(dāng)有新文件出現(xiàn),就需要把文件采集到HDFS中去

思路

根據(jù)需求,首先定義以下3大要素

  1. 數(shù)據(jù)源組件,即source ——監(jiān)控文件目錄 : spooldir
    1. 監(jiān)視一個目錄,只要目錄中出現(xiàn)新文件,就會采集文件中的內(nèi)容
    2. 采集完成的文件,會被agent自動添加一個后綴:COMPLETED
    3. 所監(jiān)視的目錄中不允許重復(fù)出現(xiàn)相同文件名的文件
  2. 下沉組件,即sink——HDFS文件系統(tǒng) : hdfs sink
  3. 通道組件,即channel——可用file channel 也可以用內(nèi)存channel
Step 1: Flume 配置文件
cd  /export/servers/apache-flume-1.8.0-bin/conf
mkdir -p /export/servers/dirfile
vim spooldir.conf
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
##注意:不能往監(jiān)控目中重復(fù)丟同名文件
a1.sources.r1.type = spooldir
a1.sources.r1.spoolDir = /export/servers/dirfile
a1.sources.r1.fileHeader = true
# Describe the sink
a1.sinks.k1.type = hdfs
a1.sinks.k1.channel = c1
a1.sinks.k1.hdfs.path = hdfs://node01:8020/spooldir/files/%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

#生成的文件類型,默認(rèn)是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

Channel參數(shù)解釋

capacity:默認(rèn)該通道中最大的可以存儲的event數(shù)量
trasactionCapacity:每次最大可以從source中拿到或者送到sink中的event數(shù)量
keep-alive:event添加到通道中或者移出的允許時間

Step 2: 啟動 Flume
bin/flume-ng agent -c ./conf -f ./conf/spooldir.conf -n a1 -Dflume.root.logger=INFO,console
Step 3: 上傳文件到指定目錄

將不同的文件放到下面目錄里面去,注意文件不能重名

cd /export/servers/dirfile

2.2.4. 采集文件到 HDFS

需求

比如業(yè)務(wù)系統(tǒng)使用log4j生成的日志,日志內(nèi)容不斷增加,需要把追加到日志文件中的數(shù)據(jù)實時采集到hdfs

分析

根據(jù)需求,首先定義以下3大要素

  • 采集源,即source——監(jiān)控文件內(nèi)容更新 : exec ‘tail -F file’
  • 下沉目標(biāo),即sink——HDFS文件系統(tǒng) : hdfs sink
  • Source和sink之間的傳遞通道——channel,可用file channel 也可以用 內(nèi)存channel
Step 1: 定義 Flume 配置文件
cd /export/servers/apache-flume-1.8.0-bin/conf
vim tail-file.conf
agent1.sources = source1
agent1.sinks = sink1
agent1.channels = channel1

# Describe/configure tail -F source1
agent1.sources.source1.type = exec
agent1.sources.source1.command = tail -F /export/servers/taillogs/access_log
agent1.sources.source1.channels = channel1


# Describe sink1
agent1.sinks.sink1.type = hdfs
#a1.sinks.k1.channel = c1
agent1.sinks.sink1.hdfs.path = hdfs://node01:8020/weblog/flume-collection/%y-%m-%d/%H-%M
agent1.sinks.sink1.hdfs.filePrefix = access_log
agent1.sinks.sink1.hdfs.maxOpenFiles = 5000
agent1.sinks.sink1.hdfs.batchSize= 100
agent1.sinks.sink1.hdfs.fileType = DataStream
agent1.sinks.sink1.hdfs.writeFormat =Text
 
agent1.sinks.sink1.hdfs.round = true
agent1.sinks.sink1.hdfs.roundValue = 10
agent1.sinks.sink1.hdfs.roundUnit = minute
agent1.sinks.sink1.hdfs.useLocalTimeStamp = true

# Use a channel which buffers events in memory
agent1.channels.channel1.type = memory
agent1.channels.channel1.keep-alive = 120
agent1.channels.channel1.capacity = 500000
agent1.channels.channel1.transactionCapacity = 600

# Bind the source and sink to the channel
agent1.sources.source1.channels = channel1
agent1.sinks.sink1.channel = channel1
Step 2: 啟動 Flume
cd  /export/servers/apache-flume-1.8.0-bin
bin/flume-ng agent -c conf -f conf/tail-file.conf -n agent1  -Dflume.root.logger=INFO,console
Step 3: 開發(fā) Shell 腳本定時追加文件內(nèi)容
mkdir -p /export/servers/shells/
cd  /export/servers/shells/
vim tail-file.sh
#!/bin/bash
while true
do
 date >> /export/servers/taillogs/access_log;
  sleep 0.5;
done
Step 4: 啟動腳本
# 創(chuàng)建文件夾
mkdir -p /export/servers/taillogs
# 啟動腳本
sh /export/servers/shells/tail-file.sh

2.2.5. Agent 級聯(lián)

[圖片上傳中...(image.png-6a52c2-1566550110125-0)]

分析

第一個agent負(fù)責(zé)收集文件當(dāng)中的數(shù)據(jù),通過網(wǎng)絡(luò)發(fā)送到第二個agent當(dāng)中去
第二個agent負(fù)責(zé)接收第一個agent發(fā)送的數(shù)據(jù),并將數(shù)據(jù)保存到hdfs上面去

Step 1: Node02 安裝 Flume

將node03機(jī)器上面解壓后的flume文件夾拷貝到node02機(jī)器上面去

cd  /export/servers
scp -r apache-flume-1.8.0-bin/ node02:$PWD
Step 2: Node02 配置 Flume

在node02機(jī)器配置我們的flume

cd /export/servers/ apache-flume-1.8.0-bin/conf
vim tail-avro-avro-logger.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 /export/servers/taillogs/access_log
a1.sources.r1.channels = c1
# Describe the sink
##sink端的avro是一個數(shù)據(jù)發(fā)送者
a1.sinks = k1
a1.sinks.k1.type = avro
a1.sinks.k1.channel = c1
a1.sinks.k1.hostname = node03
a1.sinks.k1.port = 4141
a1.sinks.k1.batch-size = 10
# 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
Step 3: 開發(fā)腳本向文件中寫入數(shù)據(jù)

直接將node03下面的腳本和數(shù)據(jù)拷貝到node02即可,node03機(jī)器上執(zhí)行以下命令

cd  /export/servers
scp -r shells/ taillogs/ node02:$PWD
Step 4: Node03 Flume 配置文件

在node03機(jī)器上開發(fā)flume的配置文件

cd /export/servers/apache-flume-1.8.0-bin/conf
vim avro-hdfs.conf
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
##source中的avro組件是一個接收者服務(wù)
a1.sources.r1.type = avro
a1.sources.r1.channels = c1
a1.sources.r1.bind = node03
a1.sources.r1.port = 4141
# Describe the sink
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://node01:8020/av/%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
#生成的文件類型,默認(rèn)是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
Step 5: 順序啟動

node03機(jī)器啟動flume進(jìn)程

cd /export/servers/apache-flume-1.8.0-bin
bin/flume-ng agent -c conf -f conf/avro-hdfs.conf -n a1  -Dflume.root.logger=INFO,console

node02機(jī)器啟動flume進(jìn)程

cd /export/servers/apache-flume-1.8.0-bin/
bin/flume-ng agent -c conf -f conf/tail-avro-avro-logger.conf -n a1  -Dflume.root.logger=INFO,console

node02機(jī)器啟shell腳本生成文件

cd  /export/servers/shells
sh tail-file.sh

3. flume的高可用方案-failover

在完成單點的Flume NG搭建后,下面我們搭建一個高可用的Flume NG集群,架構(gòu)圖如下所示:

3.1. 角色分配

Flume的Agent和Collector分布如下表所示:

名稱 HOST 角色
Agent1 node01 Web Server
Collector1 node02 AgentMstr1
Collector2 node03 AgentMstr2

圖中所示,Agent1數(shù)據(jù)分別流入到Collector1和Collector2,F(xiàn)lume NG本身提供了Failover機(jī)制,可以自動切換和恢復(fù)。在上圖中,有3個產(chǎn)生日志服務(wù)器分布在不同的機(jī)房,要把所有的日志都收集到一個集群中存儲。下 面我們開發(fā)配置Flume NG集群

3.2. Node01 安裝和配置

將node03機(jī)器上面的flume安裝包以及文件生產(chǎn)的兩個目錄拷貝到node01機(jī)器上面去

node03機(jī)器執(zhí)行以下命令

cd /export/servers
scp -r apache-flume-1.8.0-bin/ node01:$PWD
scp -r shells/ taillogs/ node01:$PWD

node01機(jī)器配置agent的配置文件

cd /export/servers/apache-flume-1.8.0-bin/conf
vim agent.conf
#agent1 name
agent1.channels = c1
agent1.sources = r1
agent1.sinks = k1 k2
#
##set gruop
agent1.sinkgroups = g1
#

agent1.sources.r1.channels = c1
agent1.sources.r1.type = exec
agent1.sources.r1.command = tail -F /export/servers/taillogs/access_log
#
##set channel
agent1.channels.c1.type = memory
agent1.channels.c1.capacity = 1000
agent1.channels.c1.transactionCapacity = 100
#
## set sink1
agent1.sinks.k1.channel = c1
agent1.sinks.k1.type = avro
agent1.sinks.k1.hostname = node02
agent1.sinks.k1.port = 52020
#
## set sink2
agent1.sinks.k2.channel = c1
agent1.sinks.k2.type = avro
agent1.sinks.k2.hostname = node03
agent1.sinks.k2.port = 52020
#
##set sink group
agent1.sinkgroups.g1.sinks = k1 k2
#
##set failover
agent1.sinkgroups.g1.processor.type = failover
agent1.sinkgroups.g1.processor.priority.k1 = 10
agent1.sinkgroups.g1.processor.priority.k2 = 1
agent1.sinkgroups.g1.processor.maxpenalty = 10000

3.3. Node02 與 Node03 配置 FlumeCollection

node02機(jī)器修改配置文件

cd /export/servers/apache-flume-1.8.0-bin/conf
vim collector.conf
#set Agent name
a1.sources = r1
a1.channels = c1
a1.sinks = k1
#
##set channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
#
## other node,nna to nns
a1.sources.r1.type = avro
a1.sources.r1.bind = node02
a1.sources.r1.port = 52020
a1.sources.r1.channels = c1
#
##set sink to hdfs
a1.sinks.k1.type=hdfs
a1.sinks.k1.hdfs.path= hdfs://node01:8020/flume/failover/
a1.sinks.k1.hdfs.fileType=DataStream
a1.sinks.k1.hdfs.writeFormat=TEXT
a1.sinks.k1.hdfs.rollInterval=10
a1.sinks.k1.channel=c1
a1.sinks.k1.hdfs.filePrefix=%Y-%m-%d
#

node03機(jī)器修改配置文件

cd  /export/servers/apache-flume-1.8.0-bin/conf
vim collector.conf
#set Agent name
a1.sources = r1
a1.channels = c1
a1.sinks = k1
#
##set channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
#
## other node,nna to nns
a1.sources.r1.type = avro
a1.sources.r1.bind = node03
a1.sources.r1.port = 52020
a1.sources.r1.channels = c1
#
##set sink to hdfs
a1.sinks.k1.type=hdfs
a1.sinks.k1.hdfs.path= hdfs://node01:8020/flume/failover/
a1.sinks.k1.hdfs.fileType=DataStream
a1.sinks.k1.hdfs.writeFormat=TEXT
a1.sinks.k1.hdfs.rollInterval=10
a1.sinks.k1.channel=c1
a1.sinks.k1.hdfs.filePrefix=%Y-%m-%d

3.4. 順序啟動

node03機(jī)器上面啟動flume

cd /export/servers/apache-flume-1.8.0-bin
bin/flume-ng agent -n a1 -c conf -f conf/collector.conf -Dflume.root.logger=DEBUG,console

node02機(jī)器上面啟動flume

cd /export/servers/apache-flume-1.8.0-bin
bin/flume-ng agent -n a1 -c conf -f conf/collector.conf -Dflume.root.logger=DEBUG,console

node01機(jī)器上面啟動flume

cd /export/servers/apache-flume-1.8.0-bin
bin/flume-ng agent -n agent1 -c conf -f conf/agent.conf -Dflume.root.logger=DEBUG,console

node01機(jī)器啟動文件產(chǎn)生腳本

cd  /export/servers/shells
sh tail-file.sh

3.5. Failover 測試

下面我們來測試下Flume NG集群的高可用(故障轉(zhuǎn)移)。場景如下:我們在Agent1節(jié)點上傳文件,由于我們配置Collector1的權(quán)重比Collector2大,所以 Collector1優(yōu)先采集并上傳到存儲系統(tǒng)。然后我們kill掉Collector1,此時有Collector2負(fù)責(zé)日志的采集上傳工作,之后,我 們手動恢復(fù)Collector1節(jié)點的Flume服務(wù),再次在Agent1上次文件,發(fā)現(xiàn)Collector1恢復(fù)優(yōu)先級別的采集工作。具體截圖如下所 示:

Collector1優(yōu)先上傳

[圖片上傳失敗...(image-84445e-1566550242649)]

HDFS集群中上傳的log內(nèi)容預(yù)覽

[圖片上傳失敗...(image-8166de-1566550242649)]

Collector1宕機(jī),Collector2獲取優(yōu)先上傳權(quán)限

[圖片上傳失敗...(image-84cead-1566550242649)]

重啟Collector1服務(wù),Collector1重新獲得優(yōu)先上傳的權(quán)限

4. flume 的負(fù)載均衡

負(fù)載均衡是用于解決一臺機(jī)器(一個進(jìn)程)無法解決所有請求而產(chǎn)生的一種算法。Load balancing Sink Processor 能夠?qū)崿F(xiàn) load balance 功能,如下圖Agent1 是一個路由節(jié)點,負(fù)責(zé)將 Channel 暫存的 Event 均衡到對應(yīng)的多個 Sink組件上,而每個 Sink 組件分別連接到一個獨立的 Agent 上,示例配置,如下所示:

在此處我們通過三臺機(jī)器來進(jìn)行模擬flume的負(fù)載均衡

三臺機(jī)器規(guī)劃如下:

node01:采集數(shù)據(jù),發(fā)送到node02和node03機(jī)器上去

node02:接收node01的部分?jǐn)?shù)據(jù)

node03:接收node01的部分?jǐn)?shù)據(jù)

第一步:開發(fā)node01服務(wù)器的flume配置

node01服務(wù)器配置:

cd /export/servers/apache-flume-1.8.0-bin/conf
vim load_banlancer_client.conf
#agent name

a1.channels = c1
a1.sources = r1
a1.sinks = k1 k2

 

#set gruop

a1.sinkgroups = g1

#set channel

a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
a1.sources.r1.channels = c1
a1.sources.r1.type = exec
a1.sources.r1.command = tail -F /export/servers/taillogs/access_log

# set sink1

a1.sinks.k1.channel = c1
a1.sinks.k1.type = avro
a1.sinks.k1.hostname = node02
a1.sinks.k1.port = 52020

# set sink2
a1.sinks.k2.channel = c1
a1.sinks.k2.type = avro
a1.sinks.k2.hostname = node03
a1.sinks.k2.port = 52020
#set sink group

a1.sinkgroups.g1.sinks = k1 k2

#set failover

a1.sinkgroups.g1.processor.type = load_balance
a1.sinkgroups.g1.processor.backoff = true
a1.sinkgroups.g1.processor.selector = round_robin
a1.sinkgroups.g1.processor.selector.maxTimeOut=10000

第二步:開發(fā)node02服務(wù)器的flume配置

cd /export/servers/apache-flume-1.8.0-bin/conf

vim load_banlancer_server.conf
# Name the components on this agent

a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source

a1.sources.r1.type = avro
a1.sources.r1.channels = c1
a1.sources.r1.bind = node02
a1.sources.r1.port = 52020

# 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

第三步:開發(fā)node03服務(wù)器flume配置

node03服務(wù)器配置

cd /export/servers/apache-flume-1.8.0-bin/conf
vim load_banlancer_server.conf
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = avro
a1.sources.r1.channels = c1
a1.sources.r1.bind = node03
a1.sources.r1.port = 52020

# 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

第四步:準(zhǔn)備啟動flume服務(wù)

啟動node03的flume服務(wù)

cd /export/servers/apache-flume-1.8.0-bin
bin/flume-ng agent -n a1 -c conf -f conf/load_banlancer_server.conf -Dflume.root.logger=DEBUG,console

啟動node02的flume服務(wù)

cd /export/servers/apache-flume-1.8.0-bin
bin/flume-ng agent -n a1 -c conf -f conf/load_banlancer_server.conf -Dflume.root.logger=DEBUG,console

啟動node01的flume服務(wù)

cd /export/servers/apache-flume-1.8.0-bin

bin/flume-ng agent -n a1 -c conf -f conf/load_banlancer_client.conf -Dflume.root.logger=DEBUG,console

第五步:node01服務(wù)器運行腳本產(chǎn)生數(shù)據(jù)

cd /export/servers/shells

sh tail-file.sh

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 概要 Apache Flume 是一個分布式,可靠且可用的系統(tǒng),用于有效地從許多不同的源收集、聚合和移動大量日志數(shù)...
    Kooola大數(shù)據(jù)閱讀 4,606評論 0 6
  • 介紹 概述 Apache Flume是為有效收集聚合和移動大量來自不同源到中心數(shù)據(jù)存儲而設(shè)計的可分布,可靠的,可用...
    ximengchj閱讀 3,670評論 0 13
  • 本文是對大數(shù)據(jù)組件Flume的一個學(xué)習(xí)總結(jié),共包括如下章節(jié)的內(nèi)容: 簡介 核心概念 使用場景 快速起步 小結(jié) 一、...
    我是老薛閱讀 1,473評論 0 1
  • title: Flume構(gòu)建日志采集系統(tǒng)date: 2018-02-03 19:45tags: [flume,k...
    溯水心生閱讀 16,279評論 3 25
  • Flume概述 Flume在大數(shù)據(jù)中扮演著數(shù)據(jù)收集的角色,收集到數(shù)據(jù)以后在通過計算框架進(jìn)行處理。Flume是Clo...
    董二彎閱讀 3,765評論 2 8

友情鏈接更多精彩內(nèi)容