教培参考
教育培训行业知识型媒体
发布时间: 2024年12月24日 03:36
③ Channel:angent 内部的数据传输通道,用于从 source
flume 接收telnet网络数据
vinetcat-logger.conf# 定义这个agent中各组件的名字a1.sources = r1a1.sinks = k1a1.channels = c1 # 描述和配置source组件:r1a1.sources.r1.type = netcata1.sources.r1.bind = localhosta1.sources.r1.port = 44444 # 描述和配置sink组件:k1a1.sinks.k1.type = logger # 描述和配置channel组件,此处使用是内存缓存的方式a1.channels.c1.type = memorya1.channels.c1.capacity = 1000a1.channels.c1.transactionCapacity = 100 # 描述和配置sourcechannel sink之间的连接关系a1.sources.r1.channels = c1a1.sinks.k1.channel = c1 |
启动Flume
[hd@Masterflume]# flume-ng agent -c /home/hd/apps/flume/conf/-f example/netcat-logger.conf -n a1-Dflume.root.logger=INFO,console
Flume采集日志文件到HDFS
# Name the components on this agenta1.sources = r1a1.sinks = k1a1.channels = c1 # Describe/configure the source#监听目录,spoolDir指定目录,fileHeader要不要给文件夹前坠名a1.sources.r1.type = spooldira1.sources.r1.spoolDir = /home/hadoop/flumespoola1.sources.r1.fileHeader = true # Describe the sinka1.sinks.k1.type = logger # Use a channel which buffers events in memorya1.channels.c1.type = memorya1.channels.c1.capacity = 1000a1.channels.c1.transactionCapacity = 100 # Bind the source and sink to the channela1.sources.r1.channels = c1a1.sinks.k1.channel = c1 |
启动Flume
[hd@masterflume]# flume-ng agent -c /home/hd/apps/flume/conf/-f example/spool-logger.conf -n a1-Dflume.root.logger=INFO,console
微信扫码关注公众号
获取更多考试热门资料