高可用flume-ng搭建
发表于:2025-12-01 作者:千家信息网编辑
千家信息网最后更新 2025年12月01日,一、概述1.通过搭建高可用flume来实现对数据的收集并存储到hdfs上,架构图如下:二、配置Agent1.cat flume-client.properties#name the component
千家信息网最后更新 2025年12月01日高可用flume-ng搭建
一、概述
1.通过搭建高可用flume来实现对数据的收集并存储到hdfs上,架构图如下:

二、配置Agent
1.cat flume-client.properties
#name the components on this agent 声明source、channel、sink的名称 a1.sources = r1 a1.sinks = k1 k2 a1.channels = c1 #Describe/configure the source 声明source的类型为通过tcp的方式监听本地端口5140 a1.sources.r1.type = syslogtcp a1.sources.r1.port = 5140 a1.sources.r1.host = localhost a1.sources.r1.channels = c1 #define sinkgroups 此处配置k1、k2的组策略,类型为均衡负载方式 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 #define the sink 1 数据流向,都是通过avro方式发到两台collector机器 a1.sinks.k1.type=avro a1.sinks.k1.hostname=hadoop1 a1.sinks.k1.port=5150 #define the sink 2 a1.sinks.k2.type=avro a1.sinks.k2.hostname=hadoop2a1.sinks.k2.port=5150 # Use a channel which buffers events in memory 指定channel的类型为内存模式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 a1.sinks.k2.channel=c1
#a2和a3的配置和a1相同
三、配置Collector
1.cat flume-server.properties
#name the components on this agent 声明source、channel、sink的名称collector1.sources = r1 collector1.channels = c1collector1.sinks = k1 # Describe the source 声明source的类型为avrocollector1.sources.r1.type = avro collector1.sources.r1.port = 5150 collector1.sources.r1.bind = 0.0.0.0 collector1.sources.r1.channels = c1 # Describe channels c1 which buffers events in memory 指定channel的类型为内存模式collector1.channels.c1.type = memory collector1.channels.c1.capacity = 1000 collector1.channels.c1.transactionCapacity = 100 # Describe the sink k1 to hdfs 指定sink数据流向hdfscollector1.sinks.k1.type = hdfs collector1.sinks.k1.channel = c1 collector1.sinks.k1.hdfs.path = hdfs://master/user/flume/logcollector1.sinks.k1.hdfs.fileType = DataStream collector1.sinks.k1.hdfs.writeFormat = TEXT collector1.sinks.k1.hdfs.rollInterval = 300 collector1.sinks.k1.hdfs.filePrefix = %Y-%m-%d collector1.sinks.k1.hdfs.round = true collector1.sinks.k1.hdfs.roundValue = 5 collector1.sinks.k1.hdfs.roundUnit = minute collector1.sinks.k1.hdfs.useLocalTimeStamp = true
#collector2配置和collector1相同
四、启动
1.在Collector上启动fulme-ng
flume-ng agent -n collector1 -c conf -f /usr/local/flume/conf/flume-server.properties -Dflume.root.logger=INFO,console# -n 后面接配置文件中的Agent Name
2.在Agent上启动flume-ng
flume-ng agent -n a1 -c conf -f /usr/local/flume/conf/flume-client.properties -Dflume.root.logger=INFO,console
五、测试
[root@hadoop5 ~]# echo "hello" | nc localhost 5140 #需要安装nc
17/09/03 22:56:58 INFO source.AvroSource: Avro source r1 started.17/09/03 22:59:09 INFO ipc.NettyServer: [id: 0x60551752, /192.168.100.15:34310 => /192.168.100.11:5150] OPEN17/09/03 22:59:09 INFO ipc.NettyServer: [id: 0x60551752, /192.168.100.15:34310 => /192.168.100.11:5150] BOUND: /192.168.100.11:515017/09/03 22:59:09 INFO ipc.NettyServer: [id: 0x60551752, /192.168.100.15:34310 => /192.168.100.11:5150] CONNECTED: /192.168.100.15:3431017/09/03 23:03:54 INFO hdfs.HDFSDataStream: Serializer = TEXT, UseRawLocalFileSystem = false17/09/03 23:03:54 INFO hdfs.BucketWriter: Creating hdfs://master/user/flume/log/2017-09-03.1504494234038.tmp
六、总结
高可用flume-ng一般有两种模式:load_balance和failover。此次使用的是load_balance,failover的配置如下:
#set failovera1.sinkgroups.g1.processor.type = failovera1.sinkgroups.g1.processor.priority.k1 = 10a1.sinkgroups.g1.processor.priority.k2 = 1a1.sinkgroups.g1.processor.maxpenalty = 10000
一些常用的source、channel、sink类型如下:
配置
类型
数据
方式
模式
相同
内存
名称
均衡
常用
文件
机器
架构
端口
策略
建高
存储
测试
监听
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
厦门一联网络技术服务有限公司
深圳易鸿达软件开发有限公司
徐汇区合格软件开发排名靠前
扎实搞好网络安全风险评估
开源dhcp服务器
智创通达网络技术有限公司
网络安全三同步是哪里提出的
服务器数据库备份方案
网络安全与执法专业视力要求
网络安全标语海报
部队网络安全对照检查问题
基于安卓嵌入式软件开发论文
我身边的网络安全事情
网络安全法关于等保
数据库系统基础教程答案第八章
更新替换数据库数据并提醒
交行卡中心软件开发外包公司
徐州海航软件开发品质保障
sql数据库绿色版
引控软件开发
电子书怎么存到sql数据库
数据库 过滤器
上海赢堃互联网科技
麒麟10搭建yum源服务器
dcs网络安全防护系统
幻塔为什么没有红石柱服务器
网络安全三年级文明题手抄报
网络安全读研选择地方推荐
瑞视恒通服务器
沈阳app软件开发招聘信息