Flume-ng HDFS sink原理解析
HDFS sink主要处理过程在process方法: //循环batchSize次或者Channel为空 for (txnEventCount = 0; txnEventCount < batchSize; txnEventCount++) { //该方法会调用BasicTransactionSemantics的具体实现 Event event = channel.take(); if (event == null) { break; } ...... //sfWriter是一个LRU缓存,缓存对文件Handler,最大打开文件由参数maxopenfiles控制 BucketWriter bucketWriter = sfWriters.get(
Flume-ng FileChannel原理解析
v:* {behavior:url(#default#VML);} o:* {behavior:url(#default#VML);} w:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} 对于Flume来说主要有两个Channel:Memory,File;对于线上环境主要以FileChannel为主,因此这里主要讨论它的实现: 在FileChannel里主要由一个WAL的log和一个内存队列组成: FileChannel的Queue主要又以下几个部分组成: private final EventQueueBackingStore backingStore; private final InflightEventWrapper inflightTakes; private final Infli