理解flume hdfs sink round 和roll

来源:互联网 发布:网络培训怎么培训 编辑:程序博客网 时间:2024/06/04 23:26
我们在配置flume hdfs sink 的时候注意这两个配置项,比如:
collector1.sinks.sink_hdfs.hdfs.rollSize = 2048000000 collector1.sinks.sink_hdfs.hdfs.rollCount = 0 collector1.sinks.sink_hdfs.hdfs.rollInterval = 21600collector1.sinks.sink_hdfs.hdfs.round = true collector1.sinks.sink_hdfs.hdfs.roundValue = 6collector1.sinks.sink_hdfs.hdfs.roundUnit = hour



rollsize的配置表示到2G大小的时候回滚到下一个文件,也就是到了这个时间 hdfs就会rename正在写的文件到已经写完。日志是这样的:
Renaminghdfs://192.168.2.231:8020/staging/xxx/app.news.test/dt=2015-10-20/events.20151020152500.1445326173233.log.tmp tohdfs://192.168.2.231:8020/staging/xxx/app.news.test/dt=2015-10-20/events.20151020152500.1445326173233.log


rollInterval的配置表示每个6小时回滚到下一个文件,但是round的理解是,每6小时产生一个新文件,比如把24小时分成4份,假设现在的时间是15:40,如果这时候有新的日志到来,那么hdfs 会创建一个新的hdfs文件,文件名称是2015102012,就是15:40 是分布在12-18这个区间的,flume 日志:
Creating hdfs://nameservice1/staging/xxx/app.news.test/dt=2015-10-20/events.20151020120000.1445326460544.log.tmp。


1 0
原创粉丝点击