单数据源多出口案例( Sink 组)实现 | 学习笔记

简介: 快速学习单数据源多出口案例( Sink 组)实现。

开发者学堂课程数据采集系统 Flume 单数据源多出口案例( Sink 组)实现】学习笔记,与课程紧密联系,让用户快速学习知识。

课程地址:https://developer.aliyun.com/learning/course/99/detail/1638


单数据源多出口案例( Sink 组)实现


需求分析 :

图片16.png


实现步骤 :

准备工作

在 /opt/module/flume/job 目录下创建 group2 文件夹


1.创建 flume-netcat-flume.conf

配置一个接受日志文件的 Source 和一个 channel ,两个 sink,分别输送给 flume-flume-console 和 flume-flume-console2

创建配置文件并打开

[atguigu@hadoop102group2]stouch flume-netcat-flume.conf

[atquigu@hadoop102group2]svim flume-netcat-flume.conf

添加如下内容

# Name the components on this agent.

al.sources = r1

al.channels = c1

al.sinkgroups = gl

al.sinks = k1 k2

# Describe/configure the source

al.sources.rl.type =netcat

al.sources.r1.bind =localhost

al.sources.r1.port =44444

al.sinkgroups.gl.processor.type = load ballange

al.sinkgroups.gl.processor.backoff = true

al.sinkgroups.gl.processor.selector = round robin

al.sinkgroups.gl.processor.selector.maxTimeout=10000

# Describe the sink

al.sinks.kl.type = avner

al.sinks.k1.hostname = hadoop102

al.sinks.k1.port = 4141

al.sinks.k2.type = avrey

al.sinks.k2.hostname = hadoop1024

al.sinks.k2.port = 4142

# Describe the channel

al.channels.cl.type = memory

al.channels.cl.capacity = 1000

al.channels.cl.transactionCapacity = 100

# Bind the source and sink to the channel

al.sources.rl.channels = c1

al.sinkgroups.gq.sinks = k1 K2!

al.sinks.k1.chafnel = c1

al.sinks.k2.channel = c1

注: Avro 是由 Hadoop 创始人 Doug Curting 创建的一种语蓄无关的数据序列化和 RPC 框架。

 

2.创建 flume-flume-console1.conf。

配置上级 Flume 输出的 Source,输出是到本地控制台。

创建配置文件并打开。

[atguigu@hadoop102 group2]s touch flume-flume-console1.conf

[atguigu@hadoop102 group2]s yim flume-flume-consolel.conf

添加如下内容

# 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.bind = hadoop102

a2.sources.r1.port = 4141

# Describe the sink

la2.sinks.kl.type = logger

# Describe the channel

la2.channels.c1.type = memory

a2.channels.c1.capacity = 1000

a2.channels.cl.transagtioncapacity = 100

# Bind the source and sink to the channel

a2.sources.rl.channels = cl

a2.sinks.kl.channel = cl

 

3.创建 flume-flume-console2.conf

配置上级 Flume 输出的 Source,输出是到本地控制台。

创建配置文件并打开。

Tatguigu@hadoop102 group2]s touch flume-flume-console2.conf

[atguigu@hadoop102 group2]$ xim flume-flume-console2.conf

添加如下内容。

# Name the components on this agent

a3.sources = r1

a3.sinks = kl

a3.channels = c2

# Describe/configure the source.

a3.sources.rl.type =avro

a3.sources.rl.bind =hadoop102

a3.sources.rl.port =4142

# Describe the sink

a3.sinks.kl.type = logger

# Describe the channel

a3.channels.c2.type = memory

a3.channels.c2.capacity = 1000

a3.channels.c2.transactionCapacity = 100

# Bind the source and sink to the channel

a3.sources.r1.channels = c2

a3.sinks.k1.channel = c2


4.执行配置文件

分别开启对应配置文件 :

flune-flume-console2, flume-flume-console1,flume-netcat-flume

[atguigu@hadoop102 flume]$ bin/flume-nq agent --conf conf/

iname a3 --conf-file job/group2/flume-flume-console2.conf

pflume.root.logger-INFQ,console

[atguigu@hadoop102 flume]$ bin/flume-ng agent --conf _conf/

name a2

--conf-file job/group2/Flume-flume-consolel.conf

Dflume.root.logger-INFO,console

[atguiguehadoop102 flume]s bin/flume-nq agent --gonf gonf/

jname al --gonf-file job/group2/flume-netcat-flume.conf

 

5.使用 telnet 工具向本机的 44444 端口发送内容

$ telnet localhost 44444

 

6.查看 Flume2 及 Flume3 的控制台打印日志

相关文章
|
2天前
|
数据采集 人工智能 安全
|
11天前
|
云安全 监控 安全
|
3天前
|
自然语言处理 API
万相 Wan2.6 全新升级发布!人人都能当导演的时代来了
通义万相2.6全新升级,支持文生图、图生视频、文生视频,打造电影级创作体验。智能分镜、角色扮演、音画同步,让创意一键成片,大众也能轻松制作高质量短视频。
990 151
|
3天前
|
编解码 人工智能 机器人
通义万相2.6,模型使用指南
智能分镜 | 多镜头叙事 | 支持15秒视频生成 | 高品质声音生成 | 多人稳定对话
|
16天前
|
机器学习/深度学习 人工智能 自然语言处理
Z-Image:冲击体验上限的下一代图像生成模型
通义实验室推出全新文生图模型Z-Image,以6B参数实现“快、稳、轻、准”突破。Turbo版本仅需8步亚秒级生成,支持16GB显存设备,中英双语理解与文字渲染尤为出色,真实感和美学表现媲美国际顶尖模型,被誉为“最值得关注的开源生图模型之一”。
1690 9
|
8天前
|
人工智能 自然语言处理 API
一句话生成拓扑图!AI+Draw.io 封神开源组合,工具让你的效率爆炸
一句话生成拓扑图!next-ai-draw-io 结合 AI 与 Draw.io,通过自然语言秒出架构图,支持私有部署、免费大模型接口,彻底解放生产力,绘图效率直接爆炸。
635 152
|
10天前
|
人工智能 安全 前端开发
AgentScope Java v1.0 发布,让 Java 开发者轻松构建企业级 Agentic 应用
AgentScope 重磅发布 Java 版本,拥抱企业开发主流技术栈。
608 14
|
9天前
|
人工智能 自然语言处理 API
Next AI Draw.io:当AI遇见Draw.io图表绘制
Next AI Draw.io 是一款融合AI与图表绘制的开源工具,基于Next.js实现,支持自然语言生成架构图、流程图等专业图表。集成多款主流大模型,提供智能绘图、图像识别优化、版本管理等功能,部署简单,安全可控,助力技术文档与系统设计高效创作。
683 151