apache flume多代理

8yoxcaq7  于 2021-06-03  发布在  Flume
关注(0)|答案(2)|浏览(585)

我测试了apacheflume将文件从本地传输到hdfs。但是,如果源文件来自多个服务器(从不同服务器的本地文件传输到hdfs),我可以只运行一个flume示例并将更多代理添加到flume-conf.properties吗?
如果可以,如何在flume-conf.properties中编辑以下参数:

agent1.sources.spooldirSource1.spoolDir = ?(server1/path)
agent2.sources.spooldirSource2.spoolDir = ?(server2/path)

还有,我怎么跑Flume?

./flume-ng agent -n agent -c conf -f apache-flume-1.4.0-bin/conf/flume-conf.properties

只能运行一个Flume。两个以上呢?

yhuiod9q

yhuiod9q1#

为您需要的内容添加多个源,但将它们配置为使用同一个通道-然后将使用同一个源。所以有点像(注意这个片段是不完整的):

agent1.sources.spooldirSource1.spooldir = server1/path
agent1.sources.spooldirSource1.channel = myMemoryChannel
agent1.sources.spooldirSource2.spooldir = server2/path
agent1.sources.spooldirSource2.channel = myMemoryChannel
ki1q1bka

ki1q1bka2#

对两个源使用同一个通道并不是好的做法,您可以很容易地从该通道的内存(对于memorychannel)中取出,在这种情况下。最好对每个源使用一个通道(对于同一个代理)

a1.sources = r1 r2
a1.sinks = k1 k2
a1.channels = c1 c2

然后将源r1链接到通道c1,将源r2链接到通道c2

相关问题