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服务器,用户 ...
随机推荐
- [CTSC2010]性能优化
[CTSC2010]性能优化 循环卷积快速幂 两个注意点:n+1不是2^k*P+1形式,任意模数又太慢?n=2^k1*3^k2*5^k3*7^k4 多路分治!深刻理解FFT运算本质:分治,推式子得到从 ...
- python中深拷贝和浅拷贝
python中所谓浅拷贝就是对引用的拷贝,所谓深拷贝就是对对象的资源的拷贝. 首先,对赋值操作我们要有以下认识: 赋值是将一个对象的地址赋值给一个变量,让变量指向该地址( 旧瓶装旧酒 ). 修改不可变 ...
- react-native实现电影列表
页面运行效果 代码: import React, { Component } from "react"; import { Image, FlatList, StyleSheet, ...
- 美丽的webpack-bundle-analyzer
webpack-bundle-analyzer -- Webpack 插件和 CLI 实用程序,她可以将打包后的内容束展示为方便交互的直观树状图,让我们知道我们所构建包中真正引入的内容: 我们可以借助 ...
- 第二十三篇-ubuntu18.04怎么下载播放器以及如何设置默认播放器
下载播放器 安装命令:sudo apt-get install smplayer再安装解码器: 安装win32codecs包 如果是intel的CPU 代码: sudo apt-get install ...
- GUI制作仿qq窗口
使用工具:python3.6, pycharm 使用模块: tkinter模块:("Tk 接口")是Python的标准Tk GUI工具包的接口,位Python的内置模块,直接i ...
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:co
在pom中加入下面代码: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId&g ...
- (最小生成树 并查集)P1111 修复公路 洛谷
题目背景 A地区在地震过后,连接所有村庄的公路都造成了损坏而无法通车.政府派人修复这些公路. 题目描述 给出A地区的村庄数N,和公路数M,公路是双向的.并告诉你每条公路的连着哪两个村庄,并告诉你什么时 ...
- (注意输入格式)bistuoj(旧)1237 成绩统计
成绩统计 Time Limit(Common/Java):1000MS/3000MS Memory Limit:65536KByteTotal Submit:88 ...
- 如何重置mysql中的root密码
方法一: 在my.ini的[mysqld]字段加入:skip-grant-tables重启mysql服务,这时的mysql不需要密码即可登录数据库 然后进入mysqlmysql>use mysq ...