關於Flume中Chanel.Selector.header解釋

來源:互聯網
上載者:User

標籤:

flume內建的ChannelSelector有兩種,分別是Replicating和Multiplexing。

Replicating類型的ChannelSelector會針對每一個Event,拷貝到所有的Channel中,這是預設的ChannelSelector。

replicating類型的ChannelSelector例子如下

 1 a1.sources = r1 2 a1.channels = c1 c2 # 如果有100個Event,那麼c1和c2中都會有這100個事件 3  4 a1.channels.c1.type = memory 5 a1.channels.c1.capacity = 1000 6 a1.channels.c1.transactionCapacity = 100 7  8  9 a1.channels.c2.type = memory10 a1.channels.c2.capacity = 100011 a1.channels.c2.transactionCapacity = 100

 

Multiplexing類型的ChannelSelector會根據Event中Header中的某個屬性決定分發到哪個Channel。

multiplexing類型的ChannelSelector例子如下:

1 a1.sources = r12 3 a1.sources.source1.selector.type = multiplexing4 a1.sources.source1.selector.header = validation # 以header中的validation對應的值作為條件5 a1.sources.source1.selector.mapping.SUCCESS = c2 # 如果header中validation的值為SUCCESS,使用c2這個channel6 a1.sources.source1.selector.mapping.FAIL = c1 # 如果header中validation的值為FAIL,使用c1這個channel7 a1.sources.source1.selector.default = c1 # 預設使用c1這個channel
a1.sources.source1.selector.header = validation # 以header中的validation對應的值作為條件

同理,如下conf檔案:
 1 # example.conf: A single-node Flume configuration 2  3 # Name the components on this agent 4 a1.sources = r1 5 a1.sinks = k1 6 a1.channels = c1 7  8 # Describe/configure the source 9 a1.sources.r1.type = netcat10 a1.sources.r1.bind = localhost11 a1.sources.r1.port = 4444412 13 a1.sources.r1.interceptors = i114 a1.sources.r1.interceptors.i1.type = regex_extractor15 a1.sources.r1.interceptors.i1.regex = (\\d):(\\d):(\\d)16 a1.sources.r1.interceptors.i1.serializers = s1 s2 s317 a1.sources.r1.interceptors.i1.serializers.s1.name = ip18 a1.sources.r1.interceptors.i1.serializers.s2.name = domain19 a1.sources.r1.interceptors.i1.serializers.s3.name = course20 21 a1.sources.r1.selector.type = multiplexing22 a1.sources.r1.selector.header = course23 a1.sources.r1.selector.default = c124 25 # Describe the sink26 a1.sinks.k1.type = logger27 28 # Use a channel which buffers events in memory29 a1.channels.c1.type = memory30 a1.channels.c1.capacity = 100031 a1.channels.c1.transactionCapacity = 10032 33 # Bind the source and sink to the channel34 a1.sources.r1.channels = c135 a1.sinks.k1.channel = c1

source r1中的頭部有IP、Domain和cource三種資訊,而r1的selector.header = course,表示selector只對IP,Domain和Cource中的Cource進行判斷選擇,然後再劃分channel。

關於Flume中Chanel.Selector.header解釋

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.