Flume将txt文件更改为二进制文件

时间:2014-05-07 18:53:44

标签: hadoop hdfs flume spool

我正在使用Flume假脱机目录并将文件上传到hdfs。这些是txt / csv文件,我想在hdfs中以这种格式使用它们。但Flume将它们作为二进制文件加载......

这是我的配置:

tier1.sources  = source1
tier1.channels = channel1
tier1.sinks    = sink1

tier1.sources.source1.type     = spooldir
tier1.sources.source1.channels = channel1
tier1.sources.source1.spoolDir = /var/data
tier1.sources.source1.fileHeader = false
tier1.sources.source1.deletePolicy = immediate
tier1.channels.channel1.type   = memory
tier1.sinks.sink1.type         = hdfs
tier1.sinks.sink1.channel      = channel1
tier1.sinks.sink1.hdfs.path = /user/hdfs/%y-%m-%d/
tier1.sinks.sink1.hdfs.writeFormat=Text
tier1.sinks.sink1.hdfs.useLocalTimeStamp = true
tier1.sinks.sink1.hdfs.rollInterval = 30

tier1.channels.channel1.capacity = 100

我应该更改Flume如何将txt文件作为txt文件加载?

1 个答案:

答案 0 :(得分:1)

这可以解决你的问题:

  

tier1.sinks.sink1.hdfs.fileType = DataStream

     

tier1.sinks.sink1.hdfs.writeFormat =文字