分享

@aboutyun 元老!flume采集数据不完整,再次求大神出山!

zhangshuai 发表于 2015-7-1 15:51:35 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 3 31563
以下是配置文件,在采集5M的文件的时候,到了300多KB。就自动完成了采集。。。。。。。。。
数据只有很少一部分在hdfs。刚接触不了解flume,但是日志也不报错。我就冒的法子了。。

a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = spooldir
#a1.sources.r1.bind = localhost
#a1.sources.r1.port = 44444
a1.sources.r1.spoolDir = /root/log_g
a1.sources.r1.fileHeader = true
a1.sources.r1.inputCharset = utf-8
a1.sources.r1.bufferMaxLines = 500000000

# Describe the sink
#a1.sinks.k1.type = logger
a1.channels = c1
a1.sinks = k1
a1.sinks.k1.type = hdfs
a1.sinks.k1.channel = c1
a1.sinks.k1.hdfs.path =hdfs://master:9000/user/flume1/%Y-%m-%d
a1.sinks.k1.hdfs.filePrefix = events-
a1.sinks.k1.hdfs.fileType=DataStream
a1.sinks.k1.hdfs.writeFormat=Text
a1.sinks.k1.hdfs.round = true
a1.sinks.k1.hdfs.rollCount = 0
a1.sinks.k1.hdfs.rollSize = 0
a1.sinks.k1.hdfs.rollInterval = 30
a1.sinks.k1.hdfs.minBlockReplicas = 1

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 5000
a1.channels.c1.transactionCapacity = 1000

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
a1.sinks.k1.hdfs.roundValue = 1
a1.sinks.k1.hdfs.roundUnit = hour
a1.sinks.k1.hdfs.useLocalTimeStamp = true

a1.sinks.k1.hdfs.rollSize = 0
a1.sinks.k1.hdfs.rollCount = 0
a1.sinks.k1.hdfs.rollInterval = 30
a1.sinks.k1.hdfs.minBlockReplicas = 1

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 5000
a1.channels.c1.transactionCapacity = 1000

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

已有(3)人评论

跳转到指定楼层
nextuser 发表于 2015-7-1 16:14:41
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = spooldir
#a1.sources.r1.bind = localhost
#a1.sources.r1.port = 44444
a1.sources.r1.spoolDir = /root/log_g
a1.sources.r1.fileHeader = true
a1.sources.r1.inputCharset = utf-8
a1.sources.r1.bufferMaxLines = 500000000

# Describe the sink
#a1.sinks.k1.type = logger
a1.channels = c1
a1.sinks = k1
a1.sinks.k1.type = hdfs
a1.sinks.k1.channel = c1
a1.sinks.k1.hdfs.path =hdfs://master:9000/user/flume1/%Y-%m-%d
a1.sinks.k1.hdfs.filePrefix = events-
a1.sinks.k1.hdfs.fileType=DataStream
a1.sinks.k1.hdfs.writeFormat=Text
a1.sinks.k1.hdfs.round = true
a1.sinks.k1.hdfs.rollCount = 0
a1.sinks.k1.hdfs.rollSize = 0
a1.sinks.k1.hdfs.rollInterval = 30
a1.sinks.k1.hdfs.minBlockReplicas = 1

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 5000
a1.channels.c1.transactionCapacity = 1000


# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
a1.sinks.k1.hdfs.roundValue = 1
a1.sinks.k1.hdfs.roundUnit = hour
a1.sinks.k1.hdfs.useLocalTimeStamp = true


a1.sinks.k1.hdfs.rollSize = 0
a1.sinks.k1.hdfs.rollCount = 0
a1.sinks.k1.hdfs.rollInterval = 30
a1.sinks.k1.hdfs.minBlockReplicas = 1


# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 5000
a1.channels.c1.transactionCapacity = 1000


# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1


红字部分感觉多余了那,还有使用内存的话,内存要足够大。




最好使用硬盘

尝试下面配置
agent1表示代理名称
agent1.sources=source1
agent1.sinks=sink1
agent1.channels=channel1


#配置source1
agent1.sources.source1.type=spooldir
agent1.sources.source1.spoolDir=/usr/aboutyunlog
agent1.sources.source1.channels=channel1
agent1.sources.source1.fileHeader = false

#配置sink1
agent1.sinks.sink1.type=hdfs
agent1.sinks.sink1.hdfs.path=hdfs://master:8020/aboutyunlog
agent1.sinks.sink1.hdfs.fileType=DataStream
agent1.sinks.sink1.hdfs.writeFormat=TEXT
agent1.sinks.sink1.hdfs.rollInterval=4
agent1.sinks.sink1.channel=channel1


#配置channel1
agent1.channels.channel1.type=file
agent1.channels.channel1.checkpointDir=/usr/aboutyun_tmp123

agent1.channels.channel1.dataDirs=/usr/aboutyun_tmp



回复

使用道具 举报

zhangshuai 发表于 2015-7-1 16:29:49
nextuser 发表于 2015-7-1 16:14
a1.sources = r1
a1.sinks = k1
a1.channels = c1

你的配置有问题啊..Exception in thread "agent-shutdown-hook" java.lang.IllegalStateException: Channel closed[channel=channel1]
回复

使用道具 举报

nextuser 发表于 2015-7-1 18:05:45
zhangshuai 发表于 2015-7-1 16:29
你的配置有问题啊..Exception in thread "agent-shutdown-hook" java.lang.IllegalStateException: Chann ...




有些是需要修改的,参考这位大神的

让你快速认识flume及安装和使用flume1.5传输数据(日志)到hadoop2.2
比如监控目录等
/usr/aboutyunlog




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条