Flume安装配置

Flume安装配置

1、上传安装包,解压

2、修改配置文件

cd /root/apps/apache-flume-1.6.0-bin/conf
cp flume-env.sh.template ./flume-env.sh
vi flume-env.sh
只用修改JAVA_HOME=jdk目录

可以输入命令:

:r! echo /root/apps/jdk1.8.0_60

3、在apache-flume-1.6.0-bin目录下,建文件夹myconf,在myconf中创建文件netcat-console.conf,并写入以下内容

a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = 192.168.139.11
a1.sources.r1.port = 44444
# Describe the sink
a1.sinks.k1.type = logger
# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
# Bind the source and sink to the channel
a1.sources.r1.channels = c1a1.sinks.k1.channel = c1

4、启动命令

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

5、访问命令

telnet localhost 44444

常见错误:

Flume采集数据到HDFS时,生成的文件中,开头信息有乱码:

翻看Flume文档,发现,HdfsEventSink中,hdfs.fileType默认为SequenceFile,将其改为DataStream就可以按照采集的文件原样输入到hdfs,加以下配置

a1.sinks.k1.hdfs.fileType=DataStream

用Kafka做channel的时候,运行消费者报错: 加以下配置,不让channel作为Event对象解析

 a1.channels.c1.parseAsFlumeEvent=false

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值