flume保证只要agent还可以运行,所有被agent接收到的数据都会被发送到collector,flume提供了三种级别的可靠性保证:
- End-to-end
- Store on failure
- Best effort
end-to-end保证只要agent正常的接收完event且一直运行,agent就会把接收到的event送到终点。agent会把接收到的event先写在磁盘上,当event成功发送到终点后返回确认信息,然后agent才会删除本地磁盘上的event。agent会一直尝试下去直到发送成功。
store on failure如果数据发送失败,数据发送方(agent、collector)会先把数据保存在本地磁盘上直到下游节点被修复,或者发送到其他可选择的目标节点上。与end-to-end不同的是,store on failure可能会由于组件出错或其他一些错误导致数据丢失。
best-effort不做任何QoS保证。如果node失败,任何正在传输过程中的数据会丢失。是最弱的一种可靠性保证,但也是最轻量级的。
三种级别的可靠性保证通过使用以下三种sink实现:
agentE2ESink[("machine"[,port])]
End to end. This version uses the WAL, relies on an acknowledgement, and will retry if no acknowledgement is received.
agentDFOSink[("machine"[,port])]
Disk Failover (store on failure). This agent writes to disk only if it can detect a failure on the collector. If any data is stored to disk, it periodically retires the network connection and attempts to resend.
agentBESink[("machine"[,port])]
Best Effort. This agent does not write to disk at all, and drops messages in the event of collector failures.
agentSink 是 agentE2ESink的别名。
参考: http://archive.cloudera.com/cdh/3/flume/UserGuide/index.html