网站首页 > 技术文章 正文
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,这才是正确看日志的方式
- 02-21走进git时代, 你该怎么玩?_gits
- 02-21GitHub是什么?它可不仅仅是云中的Git版本控制器
- 02-21Git常用操作总结_git基本用法
- 02-21为什么互联网巨头使用Git而放弃SVN?(含核心命令与原理)
- 02-21Git 高级用法,喜欢就拿去用_git基本用法
- 02-21Git常用命令和Git团队使用规范指南
- 02-21总结几个常用的Git命令的使用方法
- 02-21Git工作原理和常用指令_git原理详解
- 最近发表
- 标签列表
-
- cmd/c (57)
- c++中::是什么意思 (57)
- sqlset (59)
- ps可以打开pdf格式吗 (58)
- phprequire_once (61)
- localstorage.removeitem (74)
- routermode (59)
- vector线程安全吗 (70)
- & (66)
- java (73)
- org.redisson (64)
- log.warn (60)
- cannotinstantiatethetype (62)
- js数组插入 (83)
- resttemplateokhttp (59)
- gormwherein (64)
- linux删除一个文件夹 (65)
- mac安装java (72)
- reader.onload (61)
- outofmemoryerror是什么意思 (64)
- flask文件上传 (63)
- eacces (67)
- 查看mysql是否启动 (70)
- java是值传递还是引用传递 (58)
- 无效的列索引 (74)