概述
master:
]# ./bin/flume-ng agent --conf conf --conf-file ./conf/flume-client.properties_loadbalance --name a1 -Dflume.root.logger=INFO,console
slave1:
]# ./bin/flume-ng agent --conf conf --conf-file ./conf/flume-server.properties --name a1 -Dflume.root.logger=INFO,console
slave2:
]# ./bin/flume-ng agent --conf conf --conf-file ./conf/flume-server.properties --name a1 -Dflume.root.logger=INFO,console
发送数据:
for i in `seq 1 100` ;do echo '====> '$i >> 2.log ;done
结果:负载均衡实现了 数据发送轮训方式 均匀的发送到sink端
master:
# Name the components on this agent
a1.sources = r1
a1.sinks = k1 k2
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = exec
a1.sources.r1.command = tail -f /root/Data/test_data/2.log
# Describe the sink
a1.sinks.k1.type = avro
a1.sinks.k1.hostname = slave1
a1.sinks.k1.port = 52020
a1.sinks.k2.type = avro
a1.sinks.k2.hostname = slave2
a1.sinks.k2.port = 52020
# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
# agent1 name
a1.channels = c1
a1.sources = r1
a1.sinks = k1
#set channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
# other node, slave to master
a1.sources.r1.type = avro
a1.sources.r1.bind = slave1
a1.sources.r1.port = 52020
a1.sinks.k1.type = logger
slave2:输出到控制台
# agent1 name
a1.channels = c1
a1.sources = r1
a1.sinks = k1
#set channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
# other node, slave to master
a1.sources.r1.type = avro
a1.sources.r1.bind = slave2
a1.sources.r1.port = 52020
a1.sinks.k1.type = logger
a1.sources.r1.channels = c1
a1.sinks.k1.channel=c1
最后
以上就是天真棒棒糖为你收集整理的4.flume负载均衡(loadbalance)的全部内容,希望文章能够帮你解决4.flume负载均衡(loadbalance)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复