【翻譯】Flume 1.8.0 User Guide(用戶指南)

翻譯自官網flume1.8用戶指南,原文地址:Flume 1.8.0 User Guidehtml

篇幅限制,分爲如下5篇:java

【翻譯】Flume 1.8.0 User Guide(用戶指南)node

【翻譯】Flume 1.8.0 User Guide(用戶指南) sourceweb

【翻譯】Flume 1.8.0 User Guide(用戶指南) Sinkspring

【翻譯】Flume 1.8.0 User Guide(用戶指南) Channelshell

【翻譯】Flume 1.8.0 User Guide(用戶指南) Processorsapache

1、 介紹

1. 概述

  Apache Flume 是收集、彙總和移動大數據量的不一樣數據源到集中的數據倉庫的分佈式的、可靠的、可用的系統。數組

  使用flume 不只僅能夠作日誌收集。自從數據源可自定義,flume能夠轉移大量的事件數據,包括但不限於網絡數據、社交網絡數據、郵件數據和處理任何數據源的問題。緩存

  Apache Flume是Apache基金會的頂級項目。安全

  現有兩個可用的發佈版本:0.x 和 1.x。

  0.9.x的文檔在 flume0.9.x 用戶指南

  這篇文檔適用於1.4.x版本。

  新的和已使用的用戶推薦使用1.x版本,這是可使用最新版本帶來的性能提高和更靈活的配置。

2. 系統要求

  1. Java運行環境 java1.8 及以上

  2. 內存-給source、channel、sink配置足夠的內存

  3. 磁盤空間-給channel或sink配置足夠的磁盤空間

  4. 目錄權限-給agent目錄的讀寫權限

3. 架構

1.1 數據流模型

  一個flume的事件定爲爲一個byte的數據流和一組可選的字符串屬性。flume的 agent(JVm)進程是外部數據源經過(agent)到下一個目的地的組件。

      

  flume的source,消費外部(好比一個web 系統)傳遞給它的事件。外部source 發送目標flume source可識別的格式的事件到flume。如:一個Avro flume source 能夠接收Avro客戶端發送的Avro格式的事件,或者接收另外一個flume agent 的Avro sink發送的數據。一個類似的流可使用flume的 Thrift source接收Thrift sink 或者Thrift  RPC客戶端和Thrift 客戶端用任何語言使用flume Thrift 協議生成的事件。文件channel是一個例子,使用本地文件系統支撐,sink從channel裏面拿出數據,放到外部的資源庫(如HDFS)或者在流中轉發到另外一個flume的agent的source。source和sink在指定的agent中以異步的方式傳遞事件。

1.2 複雜流

  flume 容許用戶建立複雜的數據鏈路,事件在到達終點前能夠通過多個agent,也容許fail-in和fail-out的流,爲失敗的跳躍點建立上下文路由和備份路由。

1.3 可靠性

  流中的事件事件在交付到下一個agent或者最終的倉庫(如HDFS),在每一個agent的channel中事件是分段的。事件只有在他們存儲到下一個agent的channl或最終的倉庫中,纔會從channel中刪除。這就是flume在流支持的「simple-hop」的端到端可靠性交付語義。

  flume使用一個交易方法保證數據交付。source和sink分別將事件從一個channel中存儲和取出,這樣能夠確保事件流可靠的從一個點到另外一個點。在多鏈路的流中,爲了保證數據安全的存儲到下一個鏈路的channel中,上一個鏈路的sink和下一個鏈路的source都會執行交易。

1.4 可恢復性

  channel存儲事件,並管理數據恢復。flume支持持久化的備份在本地文件系統中的channel。flume也有事件存儲在內存隊列的channel,更快,可是事件存放在內存中,agent進程死亡不能恢復。

2、配置

2.1 配置一個agent

  flume的agent 配置存儲在本地配置文件中。這是一個java properties 文件格式。一個配置文件裏面能夠有一個或多個agent。配置文件裏面包括每個source,sink和channel的配置和他們怎麼綁定數據流的鏈接。

2.1.1 配置單個組件   

  每一個組件(source,sink和channel)在流中名字,類型和配置,都有特定的類型。例如,Avrosource須要接收數據的hostname(或ip 地址) 和端口號。內存channel有最大隊列容量, HDFS sink須要知道文件系統的URI, 建立文件的路徑,文件滾動的頻率等。flume agent的全部配置屬性都須要在配置文件中配置。

2.1.2 鏈接組件

  agent須要知道加載的組件和他們的鏈接方式去構建一個流。這是監聽每個agent的source,sinks和channel名字完成的和每個sink和source跟channel的鏈接。例如,一個事件流從avroWeb的Avro source到hdfs集羣的HDFS sink ,經過一文件channel鏈接。配置文件包含組件的名字和avroWeb source和hdfs-cluster sinke的綁定。

2.1.3 啓動一個aget

  使用flume發佈版本bin目錄下的shell腳本flume-ng啓動一個agent。你須要在命令行下執行agent命名、配置文件路徑和配置文件:

$ bin/flume-ng agent -n $agent_name -c conf -f conf/flume-conf.properties.template

  如今agent會啓動配置文件中的source和sink。

2.1.4 一個簡單的案列

  咱們提供一個配置文件的樣例,描述一個簡單的flume部署節點。這個配置文件讓用戶生成事件,並打印在console日誌中。

# example.conf: A single-node Flume configuration

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

# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444

# 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

   這個配置定義了一個單獨的agent a1。 a1有個監聽端口44444的source,緩存事件數據在內存的channel,記錄事件數據在console的sink。配置文件定義了各個組件,描述了他們的types和配置參數。一個配置文件可能定義多個agent,因此當一個flume進程啓動時,會傳遞一個標示,表示啓動哪個agent。

  經過這個配置文件,咱們能夠啓動flume用以下命令:

$ bin/flume-ng agent --conf conf --conf-file example.conf --name a1 -Dflume.root.logger=INFO,console

  記住在完整的部署環境咱們會輸入一個或多個選項: --config=<confi-dir>, <conf-dir>目錄包括腳本flume-env.sh 和log4j 的配置文件。在這個示例中,咱們執行flume沒有使用自定義的環境腳本,經過java參數啓動flume記錄日誌到console。

  在一個單獨的命令窗口,咱們能夠遠程44444端口,發送數據到flume:  

$ telnet localhost 44444
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
Hello world! <ENTER>
OK

  flume的控制檯會輸出事件的日誌消息

12/06/19 15:32:19 INFO source.NetcatSource: Source starting
12/06/19 15:32:19 INFO source.NetcatSource: Created serverSocket:sun.nio.ch.ServerSocketChannelImpl[/127.0.0.1:44444]
12/06/19 15:32:34 INFO sink.LoggerSink: Event: { headers:{} body: 48 65 6C 6C 6F 20 77 6F 72 6C 64 21 0D          Hello world!. }

  恭喜你- 你成功的配置和部署了一個flume的agent!接下來的章節包括agent的配置的更多細節。

2.1.5 在配置文件中使用環境

  flume有個功能能夠替代環境變量,例如:

a1.sources = r1
a1.sources.r1.type = netcat
a1.sources.r1.bind = 0.0.0.0
a1.sources.r1.port = ${NC_PORT}
a1.sources.r1.channels = c1

  只在值上有效,在能夠上無效(只有在等號的右邊有效)

  agent經過設置「propertiesImplementation = org.apache.flume.node.EnvVarResolverProperties」 能夠調用java的系統屬性。

  例如:    

$ NC_PORT=44444 bin/flume-ng agent –conf conf –conf-file example.conf –name a1 -Dflume.root.logger=INFO,console -DpropertiesImplementation=org.apache.flume.node.EnvVarResolverProperties

  以上只是一個例子,環境變量能夠經過其餘方式設置,包括設置在conf/flume-env.sh中。

2.1.6 記錄原始數據

  在許多生產環境中,經過獲取管道的原始數據流記錄流並非理想的行爲,由於這可能致使敏感數據或與安全相關的配置(如密鑰)泄漏到Flume日誌文件中。默認狀況下,Flume不會記錄這些信息。另外一方面,若是數據管道被破壞,Flume將嘗試爲調試問題提供線索。

  調試事件管道問題的一種方法是設置一個鏈接到日誌記錄器接收器的額外內存channel,它將把全部事件數據輸出到Flume日誌。然而,在某些狀況下,這種方法是不夠的。

  爲了啓用與事件和配置相關的數據的日誌記錄,除了log4j屬性以外,還必須設置一些Java系統屬性。

  爲了啓用與事件和配置相關的數據的日誌記錄,除了log4j屬性以外,還必須設置一些Java系統屬性。要啓用與配置相關的日誌記錄,請設置Java系統屬性-Dorg.apache.flume.log.printconfig=true。這能夠經過命令行傳遞,也能夠經過在flume-env.sh中的JAVA_OPTS變量中設置。

  要啓用數據日誌記錄,請設置Java系統屬性-Dorg.apache.flume.log。rawdata=true的方式與上面描述的相同。對於大多數組件,還必須將log4j日誌級別設置爲DEBUG或TRACE,以使特定於事件的日誌顯示在Flume日誌中。

  下面是一個啓用配置日誌記錄和原始數據日誌記錄的示例,同時還將Log4j日誌級別設置爲調試控制檯輸出: 

$ bin/flume-ng agent --conf conf --conf-file example.conf --name a1 -Dflume.root.logger=DEBUG,console -Dorg.apache.flume.log.printconfig=true -Dorg.apache.flume.log.rawdata=true

2.1.7 zookeeper 基礎配置

  flume支持經過Zookeeper 配置agent,這是一個實驗性的功能。配置文件須要上傳到Zookeeper中指定前綴的目錄。配置文件存儲在Zookeeper節點數據中。下面是代理a1和a2的Zookeeper節點樹的樣子

- /flume
 |- /a1 [Agent config file]
 |- /a2 [Agent config file]

  上傳配置文件後,使用以下選項啓動agent: 

$ bin/flume-ng agent –conf conf -z zkhost:2181,zkhost1:2181 -p /flume –name a1 -Dflume.root.logger=INFO,console
Argument Name Default Description
z Zookeeper鏈接字符串. 逗號分割的列表 hostname:port
p /flume zookeeper存儲flume配置的目錄

2.1.8 安裝第三方插件

  Flume具備徹底基於插件的架構。雖然Flume附帶了許多開箱即用的源、通道、接收器、序列化器等,可是存在許多與Flume分離的實現。

  儘管經過將自定義Flume組件的jar添加到Flume -env中的FLUME_CLASSPATH變量中,始終能夠包含自定義的Flume-env.sh文件,Flume如今支持一個名爲plugins的特殊目錄。它會自動選擇以特定格式打包的插件。這樣能夠更容易地管理插件打包問題,以及更簡單地調試和故障排除幾個類的問題,特別是庫依賴衝突。

2.1.9 plugins.d

  plugins.d的目錄存放在$FLUME_HOME/plugins.d, 在啓動flume-ng腳本的時候,會查找plugins.d 目錄,遵循如下格式,並在啓動java時以適當的路徑包含它們。

2.1.10 插件的目錄結構

  每個在plugins.d 下面的插件,都會有三個子目錄

  1. lib - 插件的jar(s)文件
  2. libext - 插件的依賴jar
  3. native - 全部須要的本地庫文件,如:.so 文件

   plugins.d目錄中兩個插件的示例:

plugins.d/
plugins.d/custom-source-1/
plugins.d/custom-source-1/lib/my-source.jar
plugins.d/custom-source-1/libext/spring-core-2.5.6.jar
plugins.d/custom-source-2/
plugins.d/custom-source-2/lib/custom.jar
plugins.d/custom-source-2/native/gettext.so

 2.2 數據獲取

  Flume支持許多從外部源獲取數據的機制。

2.2.1 RPC

  在Flume發行版中包含的Avro客戶端可使用Avro RPC機制將給定的文件發送到Flume Avro源:

$ bin/flume-ng avro-client -H localhost -p 41414 -F /usr/logs/log.10

  上面的命令會發送/usr/logs/log.10 的內容的flume監聽這個端口的source

2.2.2 執行命令

  有一個執行給定命令並使用輸出的exec源。輸出的一行。文本後面跟着回車(' \r ')或換行(' \n ')或二者一塊兒。

 2.2.3 網絡流

  Flume支持如下機制從流行的日誌流類型讀取數據,例如:

  1. Avro
  2. Thrift
  3. Syslog
  4. Netcat

 2.2.4 設置多鏈路流

 

  爲了跨多個代理或鏈路傳遞數據流,前一個agent的接收器和當前鏈路的源須要是avro類型,接收器指向源的主機名(或IP地址)和端口。

2.2.5 合併

  日誌收集中很是常見的狀況是大量日誌生成客戶端將數據發送到鏈接到存儲子系統的少數消費者agent。 例如,從數百個Web服務器收集的日誌發送給寫入HDFS集羣的十幾個agent。

  這能夠經過使用avro接收器配置多個第一層agent在Flume中實現,全部這些agent都指向單個代理的avro source(一樣,您能夠在這種狀況下使用thrift源/接收器/客戶端)。 第二層代理上的此源將接收的事件合併到單個channel中,該channel由sink消費到其最終目的地。

2.2.6 多路複用流程

  Flume支持將事件流多路複用到一個或多個目的地。 這是經過定義能夠複製或選擇性地將事件路由到一個或多個channel的流複用器來實現的。

  上面的例子顯示了來自agent 「foo」的源代碼將流程擴展到三個不一樣的channel。輸入流能夠複製或多路複用。 在複製流的狀況下,每一個事件被髮送到全部三個channel。 對於多路複用狀況,當事件的屬性與預配置的值匹配時,事件將被傳遞到可用通道的子集。 例如,若是一個名爲「txnType」的事件屬性設置爲「customer」,那麼它應該轉到channel1和channel3,若是它是「vendor」,那麼它應該轉到channel2,不然轉到channel3。 能夠在agent的配置文件中設置映射。

3、配置

  如前面部分所述,Flume agent程序配置是從相似於具備分層屬性設置的Java屬性文件格式的文件中讀取的。

3.1 定義流

  要在單個代理中定義流,您須要經過channel連接源和接收器。 您須要列出給定agent的源,sink和channel,而後將源和sink指向channel。 源實例能夠指定多個channel,但sink實例只能指定一個channel。 格式以下:

# list the sources, sinks and channels for the agent
<Agent>.sources = <Source>
<Agent>.sinks = <Sink>
<Agent>.channels = <Channel1> <Channel2>

# set channel for source
<Agent>.sources.<Source>.channels = <Channel1> <Channel2> ...

# set channel for sink
<Agent>.sinks.<Sink>.channel = <Channel1>

  示例中,agent 叫 「agent_foo」從給一個額外的avro客戶端讀取數據,使用內存channel,發送到HDFS。配置文件weblog.confg 就像這樣:

# list the sources, sinks and channels for the agent
agent_foo.sources = avro-appserver-src-1
agent_foo.sinks = hdfs-sink-1
agent_foo.channels = mem-channel-1

# set channel for source
agent_foo.sources.avro-appserver-src-1.channels = mem-channel-1

# set channel for sink
agent_foo.sinks.hdfs-sink-1.channel = mem-channel-1

  這將使事件從avro-AppSrv-source流向hdfs-Cluster1-sink,經過內存通道mem-channel-1。 當使用weblog.config做爲其配置文件啓動代理程序時,它將實例化該流程。

3.2 配置單個組件

  定義流後,您須要設置每一個源,sink和channel的屬性。 這是以相同的分層命名空間方式完成的,您能夠在其中設置組件類型以及特定於每一個組件的屬性的其餘值:

# properties for sources
<Agent>.sources.<Source>.<someProperty> = <someValue>

# properties for channels
<Agent>.channel.<Channel>.<someProperty> = <someValue>

# properties for sinks
<Agent>.sources.<Sink>.<someProperty> = <someValue>

須要爲Flume的每一個組件設置屬性「type」,以瞭解它須要什麼類型的對象。 每一個源,sink和channel類型都有本身的一組屬性,使其可以按預期運行。 全部這些都須要根據須要進行設置。 在前面的示例中,咱們有一個從avro-AppSrv-source到hdfs-Cluster1-sink的流程經過內存通道mem-channel-1。 這是一個顯示每一個組件配置的示例:

agent_foo.sources = avro-AppSrv-source
agent_foo.sinks = hdfs-Cluster1-sink
agent_foo.channels = mem-channel-1

# set channel for sources, sinks

# properties of avro-AppSrv-source
agent_foo.sources.avro-AppSrv-source.type = avro
agent_foo.sources.avro-AppSrv-source.bind = localhost
agent_foo.sources.avro-AppSrv-source.port = 10000

# properties of mem-channel-1
agent_foo.channels.mem-channel-1.type = memory
agent_foo.channels.mem-channel-1.capacity = 1000
agent_foo.channels.mem-channel-1.transactionCapacity = 100

# properties of hdfs-Cluster1-sink
agent_foo.sinks.hdfs-Cluster1-sink.type = hdfs
agent_foo.sinks.hdfs-Cluster1-sink.hdfs.path = hdfs://namenode/flume/webdata

#...

3.3 agent中添加多數據流

  單個Flume代理能夠包含多個獨立流。 您能夠在配置中列出多個源,sink和channel。 能夠連接這些組件以造成多個流:

# list the sources, sinks and channels for the agent
<Agent>.sources = <Source1> <Source2>
<Agent>.sinks = <Sink1> <Sink2>
<Agent>.channels = <Channel1> <Channel2>

  而後,你能夠將源和sink連接到channel(用於接收器)的相應channel(用於源),以設置兩個不一樣的流。 例如,若是您須要在agent中設置兩個流,一個從外部avro客戶端到外部HDFS,另外一個從尾部輸出到avro接收器,那麼這是一個配置來執行此操做:

# list the sources, sinks and channels in the agent
agent_foo.sources = avro-AppSrv-source1 exec-tail-source2
agent_foo.sinks = hdfs-Cluster1-sink1 avro-forward-sink2
agent_foo.channels = mem-channel-1 file-channel-2

# flow #1 configuration
agent_foo.sources.avro-AppSrv-source1.channels = mem-channel-1
agent_foo.sinks.hdfs-Cluster1-sink1.channel = mem-channel-1

# flow #2 configuration
agent_foo.sources.exec-tail-source2.channels = file-channel-2
agent_foo.sinks.avro-forward-sink2.channel = file-channel-2

3.4 配置多agent數據流

  要設置多層流,您須要有第一跳的avro / thrift接收器指向下一跳的avro / thrift源。 這將致使第一個Flume代理將事件轉發到下一個Flume agent。 例如,若是您使用avro客戶端按期向本地Flume agent發送文件(每一個事件1個文件),則此本地agent能夠將其轉發到另外一個已安裝存儲的agent。

Weblog agent 配置:

# list sources, sinks and channels in the agent
agent_foo.sources = avro-AppSrv-source
agent_foo.sinks = avro-forward-sink
agent_foo.channels = file-channel

# define the flow
agent_foo.sources.avro-AppSrv-source.channels = file-channel
agent_foo.sinks.avro-forward-sink.channel = file-channel

# avro sink properties
agent_foo.sinks.avro-forward-sink.type = avro
agent_foo.sinks.avro-forward-sink.hostname = 10.1.1.100
agent_foo.sinks.avro-forward-sink.port = 10000

# configure other pieces
#...

HDFS agent 配置:

# list sources, sinks and channels in the agent
agent_foo.sources = avro-collection-source
agent_foo.sinks = hdfs-sink
agent_foo.channels = mem-channel

# define the flow
agent_foo.sources.avro-collection-source.channels = mem-channel
agent_foo.sinks.hdfs-sink.channel = mem-channel

# avro source properties
agent_foo.sources.avro-collection-source.type = avro
agent_foo.sources.avro-collection-source.bind = 10.1.1.100
agent_foo.sources.avro-collection-source.port = 10000

# configure other pieces
#...

  在這裏,咱們將weblog agent的avro-forward-sink連接到hdfs agent的avro-collection-source。 這將致使來自外部應用程序服務器源的事件最終存儲在HDFS中。

3.5 輸出流

  如前一節所述,Flume支持輸入一個源到多個通道的流量。 輸出,複製和多路複用有兩種模式。 在複製流程中,事件將發送到全部已配置的channel。 在多路複用的狀況下,事件僅被髮送到合格channel的子集。 爲了散開流量,須要指定源的channel列表以及輸出它的策略。 這是經過添加能夠複製或多路複用的channel「選擇器」來完成的。 若是它是多路複用器,則進一步指定選擇規則。 若是您沒有指定選擇器,那麼默認狀況下它會複製:

# List the sources, sinks and channels for the agent
<Agent>.sources = <Source1>
<Agent>.sinks = <Sink1> <Sink2>
<Agent>.channels = <Channel1> <Channel2>

# set list of channels for source (separated by space)
<Agent>.sources.<Source1>.channels = <Channel1> <Channel2>

# set channel for sinks
<Agent>.sinks.<Sink1>.channel = <Channel1>
<Agent>.sinks.<Sink2>.channel = <Channel2>

<Agent>.sources.<Source1>.selector.type = replicating

  多路複用選擇具備另外一組屬性以分流流。 這須要指定事件屬性到channel集的映射。 選擇器檢查事件頭中的每一個已配置屬性。 若是它與指定的值匹配,則該事件將發送到映射到該值的全部channel。 若是沒有匹配項,則將事件發送到配置爲默認值的channel集:

# Mapping for multiplexing selector
<Agent>.sources.<Source1>.selector.type = multiplexing
<Agent>.sources.<Source1>.selector.header = <someHeader>
<Agent>.sources.<Source1>.selector.mapping.<Value1> = <Channel1>
<Agent>.sources.<Source1>.selector.mapping.<Value2> = <Channel1> <Channel2>
<Agent>.sources.<Source1>.selector.mapping.<Value3> = <Channel2>
#...

<Agent>.sources.<Source1>.selector.default = <Channel2>

  映射容許爲每一個值重疊channel。

  如下示例具備多路複用到兩個路徑的單個流。 名爲agent_foo的agent具備單個avro源和兩個連接到兩個接收器的channel:

# list the sources, sinks and channels in the agent
agent_foo.sources = avro-AppSrv-source1
agent_foo.sinks = hdfs-Cluster1-sink1 avro-forward-sink2
agent_foo.channels = mem-channel-1 file-channel-2

# set channels for source
agent_foo.sources.avro-AppSrv-source1.channels = mem-channel-1 file-channel-2

# set channel for sinks
agent_foo.sinks.hdfs-Cluster1-sink1.channel = mem-channel-1
agent_foo.sinks.avro-forward-sink2.channel = file-channel-2

# channel selector configuration
agent_foo.sources.avro-AppSrv-source1.selector.type = multiplexing
agent_foo.sources.avro-AppSrv-source1.selector.header = State
agent_foo.sources.avro-AppSrv-source1.selector.mapping.CA = mem-channel-1
agent_foo.sources.avro-AppSrv-source1.selector.mapping.AZ = file-channel-2
agent_foo.sources.avro-AppSrv-source1.selector.mapping.NY = mem-channel-1 file-channel-2
agent_foo.sources.avro-AppSrv-source1.selector.default = mem-channel-1

  選擇器檢查名爲「State」的標頭。 若是該值爲「CA」,則將其發送到mem-channel-1,若是其爲「AZ」,則將其發送到文件channel-2,或者若是其爲「NY」則爲二者。 若是「狀態」標題未設置或與三者中的任何一個都不匹配,則它將轉到mem-channel-1,其被指定爲「default」。

  選擇器還支持可選channel。 要爲標頭指定可選channel,可經過如下方式使用config參數「optional」:

# channel selector configuration
agent_foo.sources.avro-AppSrv-source1.selector.type = multiplexing
agent_foo.sources.avro-AppSrv-source1.selector.header = State
agent_foo.sources.avro-AppSrv-source1.selector.mapping.CA = mem-channel-1
agent_foo.sources.avro-AppSrv-source1.selector.mapping.AZ = file-channel-2
agent_foo.sources.avro-AppSrv-source1.selector.mapping.NY = mem-channel-1 file-channel-2
agent_foo.sources.avro-AppSrv-source1.selector.optional.CA = mem-channel-1 file-channel-2
agent_foo.sources.avro-AppSrv-source1.selector.mapping.AZ = file-channel-2
agent_foo.sources.avro-AppSrv-source1.selector.default = mem-channel-1

  選擇器將首先嚐試寫入所需的channel,若是其中一個channel沒法使用事件,則會使事務失敗。 在全部渠道上從新嘗試交易。 一旦全部必需的channel消耗了事件,則選擇器將嘗試寫入可選channel。 任何可選channel使用該事件的失敗都會被忽略而不會重試。

  若是可選channel與特定報頭的所需channel之間存在重疊,則認爲該channel是必需的,而且channel中的故障將致使重試全部必需channel集。 例如,在上面的示例中,對於標題「CA」,mem-channel-1被認爲是必需的channel,即便它被標記爲必需和可選,而且寫入此channel的失敗將致使該事件 在爲選擇器配置的全部channel上重試。

  請注意,若是標頭沒有任何所需的channel,則該事件將被寫入默認channel,並將嘗試寫入該標頭的可選channel。 若是未指定所需的channel,則指定可選channel仍會將事件寫入默認channel。 若是沒有將channel指定爲默認channel且沒有必需channel,則選擇器將嘗試將事件寫入可選channel。 在這種狀況下,任何失敗都會被忽略。

相關文章
相關標籤/搜索