一、高可用
1易桃、原理
1.1褥琐、多臺Flume部署都在多個數(shù)據(jù)源機器上,最后匯聚到同一臺Flume上晤郑,對這個單點匯聚層做高可用敌呈。
1.2、一般不會對葉子節(jié)點做高可用造寝,這樣會無窮無盡磕洪。
2、架構(gòu)圖如下:
3诫龙、核心
配置sinkgroups析显,指定處理器為failover,指定優(yōu)先級
4签赃、配置文件
4.1谷异、Agent1分尸,Agent2,Agent3根據(jù)實際情況配置歹嘹,這里只寫一種
a1.sources = r1
#配置兩個sink
a1.sinks = k1 k2
a1.channels = c1
a1.sources.r1.type = netcat
a1.sources.r1.bind = node02
a1.sources.r1.port = 44444
#定義sink組
a1.sinkgroups = g1
#組中有哪些sink
a1.sinkgroups.g1.sinks = k1 k2
#處理器采用故障轉(zhuǎn)移方式處理
a1.sinkgroups.g1.processor.type = failover
#設(shè)置k1和k2的優(yōu)先級箩绍,值越大,優(yōu)先級越高
a1.sinkgroups.g1.processor.priority.k1 = 5
a1.sinkgroups.g1.processor.priority.k2 = 10
#配置兩個sink詳情
a1.sinks.k1.type = avro
a1.sinks.k1.hostname = node03
a1.sinks.k1.port = 8888
a1.sinks.k2.type = avro
a1.sinks.k2.hostname = node03
a1.sinks.k2.port = 9999
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
a1.sources.r1.channels = c1
#兩個sink都從channel中獲取數(shù)據(jù)
a1.sinks.k1.channel = c1
a1.sinks.k2.channel = c1
4.2尺上、做高可用的兩個flume
a1.sources = r1
a1.sinks = k1
a1.channels = c1
a1.sources.r1.type = avro
a1.sources.r1.bind = node03
a1.sources.r1.port = 8888
a1.sinks.k1.type = logger
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
二材蛛、一個Agent對應(yīng)多個sink
1、使用場景
收集的數(shù)據(jù)需要同時做離線分析和實時分析怎抛,離線部分寫入HDFS卑吭,實時部分寫入Kafka
2、架構(gòu)圖
3马绝、配置文件
3.1豆赏、
3.2、
三迹淌、負載均衡
1河绽、使用場景
多服務(wù)器接收數(shù)據(jù)太多時,實現(xiàn)多服務(wù)器并發(fā)處理數(shù)據(jù)唉窃。
2耙饰、負載方式
2.1、輪詢(round_robin):內(nèi)部算法輪詢
2.2纹份、隨機(random)
3苟跪、架構(gòu)圖
4、原理
和負載均衡類似蔓涧,sinkgroups處理器類型改為負載均衡件已,也有兩臺sink的flume
5、配置
a1.sources = r1
#配置兩個sink
a1.sinks = k1 k2
a1.channels = c1
a1.sources.r1.type = netcat
a1.sources.r1.bind = node02
a1.sources.r1.port = 44444
#定義sink組
a1.sinkgroups = g1
#組中有哪些sink
a1.sinkgroups.g1.sinks = k1 k2
#處理器采用負載均衡方式
a1.sinkgroups.g1.processor.type = load_balance
a1.sinkgroups.g1.processor.backoff = true
a1.sinkgroups.g1.processor.selector = random
#配置兩個sink詳情
a1.sinks.k1.type = avro
a1.sinks.k1.hostname = node03
a1.sinks.k1.port = 8888
a1.sinks.k2.type = avro
a1.sinks.k2.hostname = node03
a1.sinks.k2.port = 9999
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
a1.sources.r1.channels = c1
#兩個sink都從channel中獲取數(shù)據(jù)
a1.sinks.k1.channel = c1
a1.sinks.k2.channel = c1