网站首页 > 技术文章 正文
Flume作为一个独立的进程运行在节点上,它监控服务器本地的文件,并根据你提供的代理配置将数据发送给接收器Kafka。
配置例子
# 定义 agent 名字
agent1.sources = src1
agent1.sinks = sink1
agent1.channels = ch1
# 配置 Source
agent1.sources.src1.type = exec
agent1.sources.src1.command = tail -F /path/to/log/file
# 配置 Channel
agent1.channels.ch1.type = memory
agent1.channels.ch1.capacity = 1000
agent1.channels.ch1.transactionCapacity = 100
# 配置 Sink
agent1.sinks.sink1.type = org.apache.flume.sink.kafka.KafkaSink
agent1.sinks.sink1.kafka.bootstrap.servers = localhost:9092
agent1.sinks.sink1.kafka.topic = my_topic
agent1.sinks.sink1.kafka.flumeBatchSize = 20
agent1.sinks.sink1.kafka.producer.acks = 1
# 将 Source, Channel 和 Sink 连接起来
agent1.sources.src1.channels = ch1
agent1.sinks.sink1.channel = ch1
运行 Flume
将以上配置保存到一个文件,例如 flume-kafka.conf。
使用以下命令启动 Flume agent:
flume-ng agent --conf /path/to/flume/conf --conf-file /path/to/flume-kafka.conf --name agent1 -Dflume.root.logger=INFO,console
通过这个配置,Flume 将从指定的日志文件中读取数据,并将这些数据传输到 Kafka 的指定主题中。
猜你喜欢
- 2024-12-29 基于 SLF4J 的 MDC 实现日志链路追踪详解
- 2024-12-29 Python日志模块logging python logger日志级别
- 2024-12-29 在Spring Boot中通过AOP技术实现日志拦截操作
- 2024-12-29 [编程基础] Python日志记录库logging总结
- 2024-12-29 如何将日志记录到 Windows事件日志 中
- 2024-12-29 SpringBoot集成logback异步日志 springboot集成日志log4j2
- 2024-12-29 Spring Boot中的Logback日志配置详解
- 2024-12-29 Linux 系统日志写入记录命令用法(logger)
- 2024-12-29 Python logging模块日志相关功能及应用示例
- 2024-12-29 Spring Boot搭建 ELK,这才是正确看日志的方式
- 1509℃桌面软件开发新体验!用 Blazor Hybrid 打造简洁高效的视频处理工具
- 532℃Dify工具使用全场景:dify-sandbox沙盒的原理(源码篇·第2期)
- 495℃MySQL service启动脚本浅析(r12笔记第59天)
- 474℃服务器异常重启,导致mysql启动失败,问题解决过程记录
- 471℃启用MySQL查询缓存(mysql8.0查询缓存)
- 452℃「赵强老师」MySQL的闪回(赵强iso是哪个大学毕业的)
- 431℃mysql服务怎么启动和关闭?(mysql服务怎么启动和关闭)
- 428℃MySQL server PID file could not be found!失败
- 最近发表
- 标签列表
-
- c++中::是什么意思 (83)
- 标签用于 (65)
- 主键只能有一个吗 (66)
- c#console.writeline不显示 (75)
- pythoncase语句 (81)
- es6includes (73)
- windowsscripthost (67)
- apt-getinstall-y (86)
- node_modules怎么生成 (76)
- chromepost (65)
- c++int转char (75)
- static函数和普通函数 (76)
- el-date-picker开始日期早于结束日期 (70)
- js判断是否是json字符串 (67)
- checkout-b (67)
- localstorage.removeitem (74)
- vector线程安全吗 (70)
- & (66)
- java (73)
- js数组插入 (83)
- linux删除一个文件夹 (65)
- mac安装java (72)
- eacces (67)
- 查看mysql是否启动 (70)
- 无效的列索引 (74)