flume之sink与channel(4)

Hdfs sink(也是最重要的一个)

#sink

test.sinks.si1.type=logger

logger的意思就是把我们收集到的日志打印到我们的屏幕上。是提供我们测试用的

hadoop fs -mkdir /flume/log

hadoop dfsadmin -safemode leave//退出安全模式

 

test.sinks.si1.type=hdfs

test.sinks.si1.hdfs.path=/flume/log

里面也有很多的配置项,在官方的文档里面有。


测试

test.sources=so1//我们的agent的名字叫testagentsourceso1

test.sinks=si1//agentsinksi1

test.channels=c1//agentchannelc1

 

#source

test.sources.so1.type=syslogtcp

test.sources.so1.host=192.168.80.100

test.sources.so1.port=5140

 

test.sources.so1.interceptors=i1

test.sources.so1.interceptors.i1.type=org.apache.flume.interceptor.TimestampInterceptor$Builder//event里面会多一些东西,这些东西我们在修改我们的文件名的时候有用,这个是flume给我们提供的。最重要的是多了一个headers

 

#sink

test.sinks.si1.type=hdfs

 

test.sinks.si1.hdfs.path=/flume/log

test.sinks.si1.hdfs.filePrefix=log%H%M//使用这个东西,必须有上面的interceptor

#channel

test.channels.c1.type=memory

test.channels.c1.capacity=1000

test.channels.c1.transactionCapacity=100

 

test.sources.so1.channels=c1

test.sinks.si1.channel=c1//把三个关联起来

当然了flume还有很多类型:

Flume Sinks

§ HDFS Sink

§ Logger Sink

§ Avro Sink

§ Thrift Sink

§ IRC Sink

§ File Roll Sink

§ Null Sink

§ HBaseSinks

 

 

channel

#channel

test.channels.c1.type=memory类型呢也有好几个,需要什么我们可以自己配置,这儿就不多说了

Flume Channels

§ Memory Channel这个是我们需要高性能的时候用的,但是缺点就是我们的文件系统如果出现问题了,我们的数据就会丢失

§ JDBC Channel这个意思我们可以先把数据存到数据库

§ File Channel这个是可以把数据先存到文件里面,安全了,但是效率不高。

 

 


你可能感兴趣的:(flume之sink与channel(4))