標籤:flume 複用 複製 通道
多工技術意在可以將一個event根據配置資訊發送特定的channel上。
A source instance can specify multiple channels, but a sink instance can only specify one channel.
Flume supports fanning out the flow from one source to multiple channels. There are two modes of fan out, replicating and multiplexing
flume支援的從source到多個channel有兩種輸出方式:複製 和 複用
1、複製模式下,source收到的event data是輸出到配置的所有channel上
2、複用模式下,source收到的event data是輸出到配置的特定的channel上
首先這種模式的選擇,flume中通過selector選取器來選擇,預設是複製模式
# list the sources, sinks and channels in the agentagent_foo.sources = avro-AppSrv-source1agent_foo.sinks = hdfs-Cluster1-sink1 avro-forward-sink2agent_foo.channels = mem-channel-1 file-channel-2# set channels for sourceagent_foo.sources.avro-AppSrv-source1.channels = mem-channel-1 file-channel-2# set channel for sinksagent_foo.sinks.hdfs-Cluster1-sink1.channel = mem-channel-1agent_foo.sinks.avro-forward-sink2.channel = file-channel-2# channel selector configurationagent_foo.sources.avro-AppSrv-source1.selector.type = multiplexingagent_foo.sources.avro-AppSrv-source1.selector.header = Stateagent_foo.sources.avro-AppSrv-source1.selector.mapping.CA = mem-channel-1agent_foo.sources.avro-AppSrv-source1.selector.mapping.AZ = file-channel-2agent_foo.sources.avro-AppSrv-source1.selector.mapping.NY = mem-channel-1 file-channel-2agent_foo.sources.avro-AppSrv-source1.selector.default = mem-channel-1
想上面這種情況就是一個複用通道的模式,這裡的header是event 資料的header,根據header的值來判斷輸出到哪一個通道上。
當然上面這種情況適用於將資料來源收集代碼耦合在自身應用代碼中的情況,因為解耦後通過其它方式而不涉及代碼來收集資料,你是無法決定這個event的header資料內容的。
複製模式就更簡單了,略!
【Flume】flume的多工技術multiplexing