概述
Flume容错机制描述
当集群中有多台Flume机器在工作的时候,就要考虑集群中随时有机器宕机的情况,当有机器宕机,如何保证数据不丢失,下面我来介绍一下Flume的容错机制。就是建立Flume备胎,创建Standby节点,虽然可以解决单节点故障问题,但是集群的资源也会浪费,因为有一个是等待的,占用资源不干活,下面来看看架构图:
Agent1配置文件:
#agent1 name
agent1.channels = c1
agent1.sources = r1
agent1.sinks = k1 k2
#set gruop
agent1.sinkgroups = g1
#set channel
agent1.channels.c1.type = memory
agent1.channels.c1.capacity = 1000
agent1.channels.c1.transactionCapacity = 100
agent1.sources.r1.channels = c1
agent1.sources.r1.type = exec
agent1.sources.r1.command = tail -F /root/logs/nginx.log
# 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 = 1
agent1.sinkgroups.g1.processor.priority.k2 = 10
# sink失败的最大回退期
agent1.sinkgroups.g1.processor.maxpenalty = 10000
Agent2和Agnet3配置文件:
# 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 = 44444
# 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
You have new mail in /var/spool/mail/root
最后
以上就是敏感康乃馨为你收集整理的Flume容错机制的全部内容,希望文章能够帮你解决Flume容错机制所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复