簡體   English   中英

為什么可選的水槽通道會導致非可選的水槽通道出現問題?

[英]Why does an optional flume channel cause a non-optional flume channel to have problems?

我的Flume配置似乎很簡單,給我帶來了很多問題。 首先讓我描述問題,然后列出配置文件。

我有3台服務器:Server1,Server2,Server3。

Server1:Netcat源/ Syslogtcp源(我在沒有安裝ack和syslogtcp的netcat上都對此進行了測試)2個內存通道2個Avro接收器(每個通道一個)復制選擇器,第二個內存通道可選

Server2,3:Avro源存儲通道Kafka接收器

在我的模擬中,Server2正在模擬“生產”,因此不會遭受任何數據丟失,而Server3在模擬“開發”並且數據丟失很好。 我的假設是,使用2個通道和2個源將使兩台服務器彼此分離,並且如果Server3發生故障,它不會影響Sever2(尤其是帶有可選配置選項!)。 然而,這種情況並非如此。 當我運行模擬並使用CTRL-C終止Server3時,我在Server2上遇到了速度變慢的情況,並且從Server2到Kafka接收器的輸出變成了爬網。 當我在Server3上恢復Flume代理時,一切恢復正常。

我沒想到這種行為。 我的預期是,因為我有兩個通道和兩個接收器,所以如果一個通道和/或接收器掉線,則另一個通道和/或接收器應該不會有問題。 這是Flume的限制嗎? 這是我的來源,接收者或渠道的限制嗎? 在使用一個代理且多個通道和接收器彼此分離的情況下,是否有辦法讓Flume發揮作用? 我真的不希望在一台計算機上為每個“環境”(生產和開發)使用多個Flume代理。 附件是我的配置文件,因此您可以以更技術性的方式查看我的操作:

SERVER1(一級代理)

#Describe the top level configuration    
agent.sources = mySource
agent.channels = defaultChannel1 defaultChannel2
agent.sinks = mySink1 mySink2

#Describe/configure the source
agent.sources.mySource.type = netcat
agent.sources.mySource.port = 6666
agent.sources.mySource.bind = 0.0.0.0
agent.sources.mySource.max-line-length = 150000
agent.sources.mySource.ack-every-event = false
#agent.sources.mySource.type = syslogtcp
#agent.sources.mySource.host = 0.0.0.0
#agent.sources.mySource.port = 7103
#agent.sources.mySource.eventSize = 150000
agent.sources.mySource.channels = defaultChannel1 defaultChannel2
agent.sources.mySource.selector.type = replicating
agent.sources.mySource.selector.optional = defaultChannel2

#Describe/configure the channel
agent.channels.defaultChannel1.type = memory
agent.channels.defaultChannel1.capacity = 5000
agent.channels.defaultChannel1.transactionCapacity = 200

agent.channels.defaultChannel2.type = memory
agent.channels.defaultChannel2.capacity = 5000
agent.channels.defaultChannel2.transactionCapacity = 200

#Avro Sink
agent.sinks.mySink1.channel = defaultChannel1
agent.sinks.mySink1.type = avro
agent.sinks.mySink1.hostname = Server2
agent.sinks.mySink1.port = 6666

agent.sinks.mySink2.channel = defaultChannel2
agent.sinks.mySink2.type = avro
agent.sinks.mySink2.hostname = Server3
agent.sinks.mySink2.port = 6666

SERVER2“ PROD”火焰代理

#Describe the top level configuration
agent.sources = mySource
agent.channels = defaultChannel
agent.sinks = mySink

#Describe/configure the source
agent.sources.mySource.type = avro
agent.sources.mySource.port = 6666
agent.sources.mySource.bind = 0.0.0.0
agent.sources.mySource.max-line-length = 150000
agent.sources.mySource.channels = defaultChannel

#Describe/configure the interceptor
agent.sources.mySource.interceptors = myInterceptor
agent.sources.mySource.interceptors.myInterceptor.type = myInterceptor$Builder

#Describe/configure the channel
agent.channels.defaultChannel.type = memory
agent.channels.defaultChannel.capacity = 5000
agent.channels.defaultChannel.transactionCapacity = 200

#Describe/configure the sink
agent.sinks.mySink.type = org.apache.flume.sink.kafka.KafkaSink
agent.sinks.mySink.topic = Server2-topic
agent.sinks.mySink.brokerList = broker1:9092, broker2:9092
agent.sinks.mySink.requiredAcks = -1
agent.sinks.mySink.batchSize = 100
agent.sinks.mySink.channel = defaultChannel

SERVER3“ DEV”火焰代理

#Describe the top level configuration
agent.sources = mySource
agent.channels = defaultChannel
agent.sinks = mySink

#Describe/configure the source
agent.sources.mySource.type = avro
agent.sources.mySource.port = 6666
agent.sources.mySource.bind = 0.0.0.0
agent.sources.mySource.max-line-length = 150000
agent.sources.mySource.channels = defaultChannel

#Describe/configure the interceptor
agent.sources.mySource.interceptors = myInterceptor
agent.sources.mySource.interceptors.myInterceptor.type = myInterceptor$Builder

#Describe/configure the channel
agent.channels.defaultChannel.type = memory
agent.channels.defaultChannel.capacity = 5000
agent.channels.defaultChannel.transactionCapacity = 200

#Describe/configure the sink
agent.sinks.mySink.type = org.apache.flume.sink.kafka.KafkaSink
agent.sinks.mySink.topic = Server3-topic
agent.sinks.mySink.brokerList = broker1:9092, broker2:9092
agent.sinks.mySink.requiredAcks = -1
agent.sinks.mySink.batchSize = 100
agent.sinks.mySink.channel = defaultChannel 

謝謝你的幫助!

我將研究如何調整此配置參數,因為它與內存通道有關:

agent.channels.defaultChannel.capacity = 5000 agent.channels.defaultChannel.transactionCapacity = 200

可能嘗試先加倍,然后再次執行測試,您應該會看到以下改進:

agent.channels.defaultChannel.capacity = 10000 agent.channels.defaultChannel.transactionCapacity = 400

在測試期間觀察Apache Flume實例的JVM也將是一件好事

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM