立即注册 登录
About云-梭伦科技 返回首页

arsenduan的个人空间 https://www.aboutyun.com/?1407 [收藏] [复制] [分享] [RSS]

日志

理解flume hdfs sink round 和roll

已有 1585 次阅读2015-12-14 18:21

我们在配置flume hdfs sink 的时候注意这两个配置项,比如:
collector1.sinks.sink_hdfs.hdfs.rollSize = 2048000000 
collector1.sinks.sink_hdfs.hdfs.rollCount = 0 
collector1.sinks.sink_hdfs.hdfs.rollInterval = 21600
collector1.sinks.sink_hdfs.hdfs.round = true 
collector1.sinks.sink_hdfs.hdfs.roundValue = 6
collector1.sinks.sink_hdfs.hdfs.roundUnit = hour

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

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

关闭

推荐上一条 /2 下一条