網(wǎng)站首頁(yè) 編程語(yǔ)言 正文
????????負(fù)載均衡是用于解決一臺(tái)機(jī)器(一個(gè)進(jìn)程)無(wú)法解決所有請(qǐng)求而產(chǎn)生的一種算法。Load balancing Sink Processor 能夠?qū)崿F(xiàn) load balance 功能,如下圖Agent1 是一個(gè)路由節(jié)點(diǎn),負(fù)責(zé)將 Channel 暫存的 Event 均衡到對(duì)應(yīng)的多個(gè) Sink組件上,而每個(gè) Sink 組件分別連接到一個(gè)獨(dú)立的 Agent 上,示例配置,如下所示:
在此處我們通過(guò)三臺(tái)機(jī)器來(lái)進(jìn)行模擬flume的負(fù)載均衡
三臺(tái)機(jī)器規(guī)劃如下:
node01:采集數(shù)據(jù),發(fā)送到node02和node03機(jī)器上去
node02:接收node01的部分?jǐn)?shù)據(jù)
node03:接收node01的部分?jǐn)?shù)據(jù)
一、開(kāi)發(fā)配置node01服務(wù)器的flume配置
node01服務(wù)配置:
cd /export/servers/apache-flume-1.6.0-cdh5.14.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 = 100a1.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
二、開(kāi)發(fā)node02服務(wù)器的flume配置
node02服務(wù)配置:
cd /export/servers/apache-flume-1.6.0-cdh5.14.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
三、開(kāi)發(fā)node03服務(wù)器flume配置
node03服務(wù)配置:
cd /export/servers/apache-flume-1.6.0-cdh5.14.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)備啟動(dòng)flume服務(wù)
啟動(dòng)node03的flume服務(wù)
cd /export/servers/apache-flume-1.6.0-cdh5.14.0-bin
bin/flume-ng agent -n a1 -c conf -f conf/load_banlancer_server.conf -Dflume.root.logger=DEBUG,console
啟動(dòng)node02的flume服務(wù)
cd /export/servers/apache-flume-1.6.0-cdh5.14.0-bin
bin/flume-ng agent -n a1 -c conf -f conf/load_banlancer_server.conf -Dflume.root.logger=DEBUG,console
啟動(dòng)node01的flume服務(wù)
cd /export/servers/apache-flume-1.6.0-cdh5.14.0-bin
bin/flume-ng agent -n a1 -c conf -f conf/load_banlancer_client.conf -Dflume.root.logger=DEBUG,console
五、node01服務(wù)器運(yùn)行腳本產(chǎn)生數(shù)據(jù)
cd /export/servers/shells
sh tail-file.sh
原文鏈接:https://blog.csdn.net/qq_15083919/article/details/121710943
相關(guān)推薦
- 2023-07-10 Gateway服務(wù)網(wǎng)關(guān)
- 2022-09-19 Python?Numpy中ndarray的常見(jiàn)操作_python
- 2022-05-24 Kubernetes部署可視化地圖的十個(gè)步驟_云其它
- 2022-05-08 C++?vector的簡(jiǎn)單實(shí)現(xiàn)_C 語(yǔ)言
- 2022-05-24 詳解利用Flutter中的Canvas繪制有趣的圖形_Android
- 2022-06-20 WPF使用VisualTreeHelper進(jìn)行命中測(cè)試_實(shí)用技巧
- 2022-10-11 Spring Boot 使用@Scheduled注解實(shí)現(xiàn)定時(shí)任務(wù)
- 2022-10-06 Python?Numpy中數(shù)組的集合操作詳解_python
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過(guò)濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支