Flume配置Load balancing Sink Processor
1 官网内容

2 找一个图来理解一目了然



3 详细配置
配置文件load_source_case.conf
配置数据入口 source到channel 配置了两个sink用来做负载均衡
#配置文件:
a1.sources= r1
a1.sinks= k1 k2
a1.channels= c1 #负载平衡
a1.sinkgroups = g1
a1.sinkgroups.g1.sinks = k1 k2
a1.sinkgroups.g1.processor.type =load_balance
a1.sinkgroups.g1.processor.backoff =true
a1.sinkgroups.g1.processor.selector=round_robin #Describe/configure the source
a1.sources.r1.type= exec
a1.sources.r1.command= tail -F /tmp/logs/test.log #Describe the sink
a1.sinks.k1.type= avro
a1.sinks.k1.hostname= 127.0.0.1
a1.sinks.k1.port= 50001 a1.sinks.k2.type= avro
a1.sinks.k2.hostname= 127.0.0.1
a1.sinks.k2.port= 50002 # Usea channel which buffers events in memory
a1.channels.c1.type= memory
a1.channels.c1.capacity= 1000
a1.channels.c1.transactionCapacity= 100 # set channel
a1.sinks.k1.channel= c1
a1.sinks.k2.channel= c1
a1.sources.r1.channels= c1
sink1配置
# Name the components on this agent
a2.sources = r1
a2.sinks = k1
a2.channels = c1 # Describe/configure the source
a2.sources.r1.type = avro
a2.sources.r1.channels = c1
a2.sources.r1.bind = 127.0.0.1
a2.sources.r1.port = 50001 # Describe the sink
a2.sinks.k1.type = logger
a2.sinks.k1.channel = c1 # Use a channel which buffers events inmemory
a2.channels.c1.type = memory
a2.channels.c1.capacity = 1000
a2.channels.c1.transactionCapacity = 100
sink2配置
# Name the components on this agent
a3.sources = r1
a3.sinks = k1
a3.channels = c1 # Describe/configure the source
a3.sources.r1.type = avro
a3.sources.r1.channels = c1
a3.sources.r1.bind = 127.0.0.1
a3.sources.r1.port = 50002 # Describe the sink
a3.sinks.k1.type = logger
a3.sinks.k1.channel = c1 # Use a channel which buffers events inmemory
a3.channels.c1.type = memory
a3.channels.c1.capacity = 1000
a3.channels.c1.transactionCapacity = 100
4启动服务
先启动两个sink flume-ng agent -c conf -f /mnt/software/flume-1.6.0/flume-conf/loadBalance/sink1.conf -n a2 -Dflume.root.logger=DEBUG,console
flume-ng agent -c conf -f /mnt/software/flume-1.6.0/flume-conf/loadBalance/sink2.conf -n a3 -Dflume.root.logger=DEBUG,console 再启动source flume-ng agent -c conf -f /mnt/software/flume-1.6.0/flume-conf/loadBalance/load_source_case.conf -n a1 -Dflume.root.logger=DEBUG,console
5 查看效果
第一次启动走了sink1 9/02/21 23:20:55 INFO ipc.NettyServer: [id: 0x617271c1, /127.0.0.1:47138 => /127.0.0.1:50001] CONNECTED: /127.0.0.1:47138
19/02/21 23:21:01 INFO sink.LoggerSink: Event: { headers:{} body: 7A 68 61 6E 67 6A 69 6E zhangjin }
19/02/21 23:21:01 INFO sink.LoggerSink: Event: { headers:{} body: 78 78 78 78 xxxx }
19/02/21 23:21:01 INFO sink.LoggerSink: Event: { headers:{} body: 79 79 79 79 yyyy }
19/02/21 23:21:01 INFO sink.LoggerSink: Event: { headers:{} body: 7A 68 61 6E 67 6A 69 6E zhangjin }
19/02/21 23:21:01 INFO sink.LoggerSink: Event: { headers:{} body: 78 78 78 78 xxxx }
19/02/21 23:21:01 INFO sink.LoggerSink: Event: { headers:{} body: 79 79 79 79 yyyy }
19/02/21 23:21:01 INFO sink.LoggerSink: Event: { headers:{} body: 7A 68 61 6E 67 6A 69 6E zhangjin }
19/02/21 23:21:01 INFO sink.LoggerSink: Event: { headers:{} body: 78 78 78 78 xxxx }
19/02/21 23:21:01 INFO sink.LoggerSink: Event: { headers:{} body: 79 79 79 79 yyyy }
19/02/21 23:21:01 INFO sink.LoggerSink: Event: { headers:{} body: 5B 7B 20 22 68 65 61 64 65 72 73 22 20 3A 7B 22 [{ "headers" :{" } 19/02/21 23:23:47 INFO sink.LoggerSink: Event: { headers:{} body: 68 65 6C 6C 6F hello } 第二次追加数据走了sink2 19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 77 6F 72 6C 64 world }
19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 6A 61 76 61 java }
19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 73 63 61 6C 61 scala }
19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 68 61 64 6F 6F 70 hadoop }
19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 7A 68 61 6E 67 6A 69 6E zhangjin }
19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 78 78 78 78 xxxx }
19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 79 79 79 79 yyyy }
19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 7A 68 61 6E 67 6A 69 6E zhangjin }
19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 78 78 78 78 xxxx }
19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 79 79 79 79 yyyy }
19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 7A 68 61 6E 67 6A 69 6E zhangjin }
19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 78 78 78 78 xxxx }
19/02/21 23:23:49 INFO sink.LoggerSink: Event: { headers:{} body: 79 79 79 79 yyyy } 数据文件 ello
world
java
scala
hadoop
zhangjin
xxxx
yyyy
zhangjin
xxxx
yyyy
zhangjin
xxxx
yyyy
[{ "headers" :{"state" : "CZ"},"body" : "TEST1"}]
hello
world
java
scala
hadoop
zhangjin
xxxx
yyyy
zhangjin
xxxx
yyyy
zhangjin
xxxx
yyyy
~
~
6 总结,从效果上来看实现了负载,选择的是轮询算法,其他的大家可以多测试一下
Flume配置Load balancing Sink Processor的更多相关文章
- Flume-Failover Sink Processor 故障转移与 Load balancing Sink 负载均衡
接上一篇:https://www.cnblogs.com/jhxxb/p/11579518.html 使用 Flume1 监控一个端口,其 sink 组中的 sink 分别对接 Flume2 和 Fl ...
- flume配置和说明(转)
Flume是什么 收集.聚合事件流数据的分布式框架 通常用于log数据 采用ad-hoc方案,明显优点如下: 可靠的.可伸缩.可管理.可定制.高性能 声明式配置,可以动态更新配置 提供上下文路由功能 ...
- Windows Server 2008配置Network Load Balancing(服务群集)
最近配置SharePoint 2013 WFE 时,客户提到要让多台WFE能load balance,于是研究了下Network Load Balancing. 当把一台服务器 ...
- Flume监听文件目录sink至hdfs配置
一:flume介绍 Flume是一个分布式.可靠.和高可用的海量日志聚合的系统,支持在系统中定制各类数据发送方,用于收集数据:同时,Flume提供对数据进行简单处理,并写到各种数据接受方(可定制)的能 ...
- Flume中的HDFS Sink配置参数说明【转】
转:http://lxw1234.com/archives/2015/10/527.htm 关键字:flume.hdfs.sink.配置参数 Flume中的HDFS Sink应该是非常常用的,其中的配 ...
- 大数据学习day36-----flume02--------1.avro source和kafka source 2. 拦截器(Interceptor) 3. channel详解 4 sink 5 slector(选择器)6 sink processor
1.avro source和kafka source 1.1 avro source avro source是通过监听一个网络端口来收数据,而且接受的数据必须是使用avro序列化框架序列化后的数据.a ...
- Network Load Balancing Technical Overview--reference
http://technet.microsoft.com/en-us/library/bb742455.aspx Abstract Network Load Balancing, a clusteri ...
- 【原创】大数据基础之Flume(2)Sink代码解析
flume sink核心类结构 1 核心接口Sink org.apache.flume.Sink /** * <p>Requests the sink to attempt to cons ...
- 负载均衡(Load Balancing)学习笔记(二)
概述 文章负载均衡(Load Balancing)学习笔记(一) 讲述了负载均衡的一般性原理,本文继续介绍常见的实现负载均衡的方法. HTTP重定向 HTTP重定向服务器是一台普通的Web服务器,用户 ...
随机推荐
- openvpn部署账号密码登录
1.开启服务器端路由转发功能: 修改配置文件/etc/sysctl.conf中 net.ipv4.ip_forward = 0 改为 net.ipv4.ip_forward = 1 [root@nod ...
- C++ 容器操作
typedef struct point { int x; int y; }Point; 在声明变量的时候就可以:Point p1; 如果没有typedef, 如: struct point { in ...
- Keyboard Hook API函数 参数说明
来源:https://www.cnblogs.com/grenet/archive/2010/12/07/1898840.html 1.Keyboard的HOOK函数分为两种,WH_KEYBOARD_ ...
- 收藏:H.264编码原理以及I帧B帧P帧
来源: https://www.cnblogs.com/herenzhiming/articles/5106178.html 前言 ----------------------- H264是新一代的编 ...
- operation=
x+=xxx 先执行xxx,再x=x+xxx 一个与之的问题 C(n,n/2) for (i=n;i>n/2;i--) v*=i/(n+1-i);每次先执行i/(n+1-i),然后 ...
- Vector使用测试
1.测试vector是否自动释放分配的空间 vector有大致两类申请空间的方式,一是vector(n,T()),一是vector(p,p+n)(p是自己申请的空间的指针). 其中第一种估计肯定会释放 ...
- vue(基础一)_基本指令的使用
一.前言 1.基本骨架 2.插值表达式{{ }} 3.vue起的作用,在开发中充当的角色MVC ...
- django模版之过滤器
过滤器,变量的显示形式的改变 一.形式:小写 {{ name | lower }} 二.串联:先转义文本到HTML,再转换每行到 <p> 标签 {{ my_text|escape|line ...
- Centos 6\7下yum安装rstudio-server\shiny-server
rstudio-server安装 #wget https://download2.rstudio.org/rstudio-server-rhel-1.1.463-x86_64.rpm #yum ins ...
- VSCode 配置
官网 https://code.visualstudio.com/ 便携化 Windows,Linux 在 Code.exe 所在目录创建 data 目录 macOS 在 Code.exe 所在目录创 ...