一、flume安装
1、上传flume包到master并解压缩
tar -zxvf flume-ng-1.2.0-cdh3u5.tar.gz 2、添加flume路径到.bash_profile中(可有可无,只为方便)
export FLUME_HOME=/home/hadoop/flume-ng-1.2.0-cdh3u5
export FLUME_CONF_DIR=$FLUME_HOME/conf3、修改flume配置文件(文件位置:flume-ng-1.2.0-cdh3u5/conf/)
cp flume-conf.properties.template flume-conf.properties
编辑flume-conf.properties
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = hd2
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 = c1
a1.sinks.k1.channel = c14、运行flume(flume-ng-1

本文详细介绍了如何在单节点环境中搭建Flume,包括安装步骤、使用exec和spooldir进行日志及文件抽取的配置实践。Flume在企业中广泛用于大数据的日志收集,其灵活性体现在只需调整配置文件即可适应不同需求。需要注意的是,Flume不支持抽取非文本文件,如PDF和JPG,尝试抽取时可能会导致错误。
最低0.47元/天 解锁文章
904

被折叠的 条评论
为什么被折叠?



