博客
关于我
flume的TaildirSource介绍及升级改造
阅读量:634 次
发布时间:2019-03-14

本文共 1374 字,大约阅读时间需要 4 分钟。

Flume 1.7.0 中引入了 taildirSource 组件,能够监控指定目录下的文件,根据正则表达式筛选文件,并支持断点续传。然而,用户发现 CDH 版本的 Flume 1.6.0 也包含该组件,而 Apache 版本的 1.7.0 则缺少 TaildirMatcher.java 以及部分代码差异,显示出 Apache 版本的实现可能更为完善。

用户选择使用 CDH 版本的 Flume 1.6.0-cdh5.5.2-bin,因其现有环境中已有该版本,没有重装 Apache 1.7.0。为了满足需求,用户配置了 Flume taildir源,并测试了其工作情况。

配置文件如下:

a1.sources = r1a1.channels = c1a1.sinks = k1a1.sources.r1.type = taildira1.sources.r1.channels = c1a1.sources.r1.positionFile = /home/hadoop/hui/taildir_position.jsona1 sourced.r1.filegroups = f1 f2a1.sources.r1.filegroups.f1 = /home/hadoop/hui/test1/.*  #匹配除换行符 \n 之外的任何单字符。*匹配前面的子表达式零次或多次a1.sources.r1.filegroups.f2 = /home/hadoop/hui/test2/.*fileHeader = truefileHeaderKey = filea1.sinks.k1.type = file_rolla1.sinks.k1.sink.directory = /home/hadoop/huia1.sinks.k1.sink.rollInterval = 0 a1.channels.c1.type = memorya1.channels.c1.capacity = 1000a1.channels.c1.transactionCapacity = 1000

测试文件结构:

.├── messages.1├── qiang├── hui.txt├── test1│   ├── hehe.txt│   └── messages.2└── test2    ├── messages.3    ├── messages.4    └── test1 → test2/test1        ├── hehe.txt        └── messages.2

运行 Flume:

bin/flume-ng agent -c . -f conf/taildir.conf -n a1 -Dflume.root.logger=INFO,console

启动后生成文件:

1489881718232-1 → hello world hehehello world 3hello world 4

进一步测试文件改名和新内容推送:

mv test2/test1/hehe.txt test2/haha.txtecho "hello china" >> test2/test1/hehe.txt

测试结果显示 Flune 正确处理文件改名和新内容。

转载地址:http://xynoz.baihongyu.com/

你可能感兴趣的文章
PostGIS在Windows上的下载与安装
查看>>
Qt开发——网络编程之UDP客户端
查看>>
postgis数据库优化_postgresql 性能优化
查看>>
postgis求面积、交集等相关函数
查看>>
postgis相关函数
查看>>
Postgres Docker版本安装mysql_fdw 插件
查看>>
Postgres invalid command \N数据恢复处理
查看>>
Postgres like 模糊查询匹配集合
查看>>
Postgres 自定义函数内实现 in 操作符的递归查询
查看>>
Postgres 返回当前时间前后指定天数的集合
查看>>
postgres--vacuum
查看>>
postgres--wal
查看>>
postgres--流复制
查看>>
postgres10配置huge_pages
查看>>
PostgreSQL 10.0 preview sharding增强 - pushdown 增强
查看>>
PostgreSQL 10.0 preview 变化 - pg_xlog,pg_clog,pg_log目录更名为pg_wal,pg_xact,log
查看>>
PostgreSQL 10.1 手册_部分 II. SQL 语言_第 15章 并行查询_15.2. 何时会用到并行查询?...
查看>>
PostgreSQL 10.1 手册_部分 II. SQL 语言_第 9 章 函数和操作符_9.23. 行和数组比较
查看>>
PostgreSQL 10.1 手册_部分 III. 服务器管理_第 21 章 数据库角色
查看>>
Qt开发——网络编程UDP网络广播软件之服务器端
查看>>