Hadoop之Flume 记录

Posted cnblogs_z_s

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hadoop之Flume 记录相关的知识,希望对你有一定的参考价值。

 

出现这个错误是自己的粗心大意,解决:

在配置flume-conf.properties文件时,source和channel的对应关系是:

myAgentName.sources.mySourceName.channels = myChannelName

myAgentName.sinks.mySinkName.channel = myChannelName

注意其中的后缀,带s和不带s后缀。

这也恰好说明

source可以“流向”多个channel,而sink只能接收一个channel的“流入”。

从channel的角度看:channel既可以接收多个source的“流入”,又可以“流向”多个sink

 

例如多对多关系:

对应的配置如下:

 1 # example.conf: A single-node Flume configuration
 2 
 3 # Name the components on this agent
 4 agent1.sources=sour1 s2 s3
 5 agent1.sinks=sink1 sink12 sink21 sink3
 6 agent1.channels=chan1 chan2 chan3
 7 
 8 # Describe/configure the source
 9 agent1.sources.sour1.type=netcat
10 agent1.sources.sour1.bind=localhost
11 agent1.sources.sour1.port=44444
12 
13 agent1.sources.s2.type=netcat
14 agent1.sources.s2.bind=localhost
15 agent1.sources.s2.port=44445
16 
17 agent1.sources.s3.type=netcat
18 agent1.sources.s3.bind=localhost
19 agent1.sources.s3.port=44446
20 
21 # Describe the sink
22 agent1.sinks.sink1.type=logger
23 agent1.sinks.sink12.type=logger
24 agent1.sinks.sink21.type=logger
25 agent1.sinks.sink3.type=logger
26 
27 # Use a channel which buffers events in memory
28 agent1.channels.chan1.type=memory
29 agent1.channels.chan1.capacity=1000
30 #agent1.channels.chan1.transactionCapacity=100
31 
32 agent1.channels.chan2.type=memory
33 agent1.channels.chan2.capacity=1000
34 
35 agent1.channels.chan3.type=memory
36 agent1.channels.chan3.capacity=1000
37 
38 
39 # Bind the source and sink to the channel
40 agent1.sources.sour1.channels=chan1 chan2
41 agent1.sources.s2.channels=chan2
42 agent1.sources.s3.channels=chan2 chan3
43 
44 agent1.sinks.sink1.channel=chan1
45 agent1.sinks.sink12.channel=chan1
46 agent1.sinks.sink21.channel=chan2
47 agent1.sinks.sink3.channel=chan3

 

以上是关于Hadoop之Flume 记录的主要内容,如果未能解决你的问题,请参考以下文章

打怪升级之小白的大数据之旅(七十一)<Hadoop生态:初识Flume>

打怪升级之小白的大数据之旅(七十一)<Hadoop生态:初识Flume>

Hadoop实战-Flume之Hello world

Hadoop之Flume

Hadoop之Flume

数仓采集之环境搭建hadoop,zookeeper,kafka,flume