【云计算】flume多路复制案例解析
小标 2018-12-13 来源 : 阅读 1375 评论 0

摘要:本文主要向大家介绍了【云计算】flume多路复制案例解析,通过具体的内容向大家展现,希望对大家学习云计算有所帮助。

本文主要向大家介绍了【云计算】flume多路复制案例解析,通过具体的内容向大家展现,希望对大家学习云计算有所帮助。


多路复制案例


一个source的数据,同时写入到多个channel中,多个channel中的数据是一样的。


 

Agent1 -à agent2/agent3


 

Agent1:


 

Source:netcat


 

Channel:memory 2


 

Sink:avro 2


 

Agent2: Agent3:


 

Source:avro


 

Channel:memory


 

Sink:logger


 

Agent之间的通信 avro


 

利用一个选择器:


 

Selecttor.type 决定多路取数据的规则


 

Agent1的配置:


 

case_six_agent01.properties


        #2个channel和2个sink的配置文件  # Name the components on this agent  a1.sources = s1  a1.sinks = k1 k2  a1.channels = c1 c2  # Describe/configure the source  a1.sources.s1.type = netcat  a1.sources.s1.bind = 192.168.191.201  a1.sources.s1.port = 44444  # 指定source进行扇出到多个channnel的规则  a1.sources.s1.selector.type = replicating  a1.sources.s1.channels = c1 c2  # Use a channel which buffers events in memory  # 指定channel c1  a1.channels.c1.type = memory  # 指定c2的channel  a1.channels.c2.type = memory  # Describe the sink  # 指定k1的设置  a1.sinks.k1.type = avro  a1.sinks.k1.channel = c1  a1.sinks.k1.hostname = 192.168.191.202  a1.sinks.k1.port = 44445  # 指定k2的  a1.sinks.k2.type = avro  a1.sinks.k2.channel = c2  a1.sinks.k2.hostname = 192.168.191.203  a1.sinks.k2.port = 44445      
 

Agent2的配置:


 

case_six_agent02.properties


        a1.sources=s1  a1.channels=c1  a1.sinks=k1  #设定sources 数据源监听本机的44444端口  a1.sources.s1.channels=c1  a1.sources.s1.type=avro  #指定ip或者主机名  a1.sources.s1.bind=192.168.191.202  #指定需要监控的端口  a1.sources.s1.port=44445  #channel  a1.channels.c1.type=memory  #sinks 写出数据 logger  a1.sinks.k1.channel=c1  a1.sinks.k1.type=logger      
 

Agent3的配置:


 

case_six_agent02.properties


        a1.sources=s1  a1.channels=c1  a1.sinks=k1  #设定sources 数据源监听本机的44444端口  a1.sources.s1.channels=c1  a1.sources.s1.type=avro  #指定ip或者主机名  a1.sources.s1.bind=192.168.191.203  #指定需要监控的端口  a1.sources.s1.port=44445  #channel  a1.channels.c1.type=memory  #sinks 写出数据 logger  a1.sinks.k1.channel=c1  a1.sinks.k1.type=logger      
 

上传,发送文件:(也直接发到相应节点上可以)


 

启动:


 

先启动agent2 和 agent3:


 

hadoop02:


 

bin/flume-ng agent --conf conf --conf-file /home/hadoop/case_six_agent02.properties --name a1 -Dflume.root.logger=INFO,console


 

hadoop03:


 

bin/flume-ng agent --conf conf --conf-file /home/hadoop/case_six_agent03.properties --name a1 -Dflume.root.logger=INFO,console


 

再启动agent1:


 

flume-ng agent --conf conf --conf-file /home/hadoop/case_six_agent01.properties --name a1 -Dflume.root.logger=INFO,console


 

发送消息


     

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标大数据云计算大数据安全频道!


本文由 @小标 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 0
看完这篇文章有何感觉?已经有0人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式AI+学习就业服务平台 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved