Flume(三) —— 断点续传 与 事务

断点续传

# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe / configure the source
a1.sources.r1.type = TAILDIR
a1.sources.r1.filegroups = f1 f2
a1.sources.r1.filegroups.f1 = /usr/local/flume/example/file1.txt
a1.sources.r1.filegroups.f2 = /usr/local/flume/example/file2.txt
a1.sources.r1.positionFile = /usr/local/flume/position/postition.json


# Describe the sink
a1.sinks.k1.type = logger

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

执行

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

运行结果

原理

在配置的/usr/local/flume/position/postition.json文件中,会发现,flume将位置信息记录在这个postition中。

[{"inode":33855378,"pos":23,"file":"/usr/local/flume/example/file1.txt"},{"inode":33855380,"pos":36,"file":"/usr/local/flume/example/file2.txt"}]

事务

put事务和take事务

原文地址:https://www.cnblogs.com/fonxian/p/12189425.html