Flume

3 篇文章 0 订阅
2 篇文章 0 订阅
1、运行flume需要的jar包,以及hadoop配置文件

/cloud/hadoop-2.6.0/share/hadoop/common/hadoop-common-2.6.0.jar
/cloud/hadoop-2.6.0/share/hadoop/common/lib/commons-configuration-1.6.jar
/cloud/hadoop-2.6.0/share/hadoop/common/lib/hadoop-auth-2.6.0.jar
/cloud/hadoop-2.6.0/share/hadoop/hdfs/hadoop-hdfs-2.6.0.jar
/cloud/hadoop-2.6.0/share/hadoop/hdfs/lib/htrace-core-3.0.4.jar

/cloud/hadoop-2.6.0/etc/hadoop/core-site.xml,hdfs-site.xml
scp {core-site.xml,hdfs-site.xml} 10.1.18.208:/cloud/flume-1.5.2/conf



2、运行
bin/flume-ng agent -n a4 -c conf -f conf/a4.conf -Dflume.root.logger=INFO,console

#定义agent名, source、channel、sink的名称
a4.sources = r1
a4.channels = c1
a4.sinks = k1

#具体定义source
a4.sources.r1.type = spooldir
a4.sources.r1.spoolDir = /home/jzk/tmp/logs

#具体定义channel
a4.channels.c1.type = memory
a4.channels.c1.capacity = 10000
a4.channels.c1.transactionCapacity = 100

#定义拦截器,为消息添加时间戳
a4.sources.r1.interceptors = i1
a4.sources.r1.interceptors.i1.type = org.apache.flume.interceptor.TimestampInterceptor$Builder


#具体定义sink
a4.sinks.k1.type = hdfs
a4.sinks.k1.hdfs.path = hdfs://hadoop01:9000/flume/%Y%m%d
a4.sinks.k1.hdfs.filePrefix = events-
a4.sinks.k1.hdfs.fileType = DataStream
#不按照条数生成文件
a4.sinks.k1.hdfs.rollCount = 0
#HDFS上的文件达到128M时生成一个文件
a4.sinks.k1.hdfs.rollSize = 134217728
#HDFS上的文件达到60秒生成一个文件
a4.sinks.k1.hdfs.rollInterval = 60

#组装source、channel、sink
a4.sources.r1.channels = c1
a4.sinks.k1.channel = c1


bin/flume-ng agent -n a2 -f conf/a2.conf -c conf -Dflume.root.logger=INFO,console

#定义agent名, source、channel、sink的名称
a2.sources = r1
a2.channels = c1
a2.sinks = k1

#具体定义source
a2.sources.r1.type = exec
a2.sources.r1.command = tail -F /home/jzk/tmp/a.log

#具体定义channel
a2.channels.c1.type = memory
a2.channels.c1.capacity = 1000
a2.channels.c1.transactionCapacity = 100

#具体定义sink
a2.sinks.k1.type = logger

#组装source、channel、sink
a2.sources.r1.channels = c1
a2.sinks.k1.channel = c1



org.apache.hadoop.io.SequenceFile
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值