checkpointDir | ~/.flume/file-channel/checkpoint | The directory where checkpoint file will be stored 检查点的目录 |
useDualCheckpoints | false | Backup the checkpoint. If this is set to true, backupCheckpointDir must be set 使用对checkpoint进行备份 |
backupCheckpointDir | – | The directory where the checkpoint is backed up to. This directory must not be the same as the data directories or the checkpoint directory 备用的检查点目录 |
dataDirs | ~/.flume/file-channel/data | Comma separated list of directories for storing log files. Using multiple directories on separate disks can improve file channel peformance 数据存储的文件夹 |
transactionCapacity | 10000 | The maximum size of transaction supported by the channel 事务里最多存多少事件 |
checkpointInterval | 30000 | Amount of time (in millis) between checkpoints 多少时间再次对内存里面的指向数据的指针保存到检查点 |
maxFileSize | 2146435071 | Max size (in bytes) of a single log file 保存数据的log文件最大值多少 |
minimumRequiredSpace | 524288000 | Minimum Required free space (in bytes). To avoid data corruption, File Channel stops accepting take/put requests when free space drops below this value 磁盘最小剩余空间 |
capacity | 1000000 | Maximum capacity of the channel 这指的是checkpoint文件存放event指针对象的最大容量 = 内存队列的对象总数 |
file channel 使用了内存序列 来保存 Event 对应在 datas/ 目录里面的数据(已经被source写入,还未被sink消费)位置的指针(一个FlumeEventPointer对象,保存了文件名 :log数字 和offset),checkpoint文件可以理解就是 内存队列的快照,为了保证内存队列的完整性,在内存队列序列化的磁盘的时候,需要锁定内存队列,此时channel不能提供服务,source不能写,sink不能读;由于checkpoint要频繁的读取,可以配置backupCheckpointDir进行备份;
从source 到 file channel 过程
一个包含多个events的事务成功提交,events会被持久化到 datas/文件夹里面 log 文件里面(有编号),指针对象会保存到内存序列里面。然后会定时在把内存队列里面指针对象给存到checkpint文件里面
其中checkpoint文件夹里面 除了 检查点文件,还有
1、 checkpoint/inflightTakes存放的是事务take的缓存数据,每隔段时间就重建文件。
2、checkpoint/inflightPuts存放的是事务对应的put缓存数据,每隔段时间就重建文件。