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事务
关于作者
后端程序员,五年开发经验,从事互联网金融方向。技术公众号「清泉白石」。如果您在阅读文章时有什么疑问或者发现文章的错误,欢迎在公众号里给我留言。