我有用户编写AVRO文件,我想使用Flume使用Flume将所有这些文件移动到HDFS中 . 所以我以后可以使用Hive或Pig来查询/分析数据 .
在客户端我安装了水槽,并有一个SpoolDir源和AVRO接收器像这样:
a1.sources = src1
a1.sinks = sink1
a1.channels = c1
a1.channels.c1.type = memory
a1.sources.src1.type = spooldir
a1.sources.src1.channels = c1
a1.sources.src1.spoolDir = {directory}
a1.sources.src1.fileHeader = true
a1.sources.src1.deserializer = avro
a1.sinks.sink1.type = avro
a1.sinks.sink1.channel = c1
a1.sinks.sink1.hostname = {IP}
a1.sinks.sink1.port = 41414
在hadoop集群上,我有这个AVRO源和HDFS接收器:
a1.sources = avro1
a1.sinks = sink1
a1.channels = c1
a1.channels.c1.type = memory
a1.sources.avro1.type = avro
a1.sources.avro1.channels = c1
a1.sources.avro1.bind = 0.0.0.0
a1.sources.avro1.port = 41414
a1.sinks.sink1.type = hdfs
a1.sinks.sink1.channel = c1
a1.sinks.sink1.hdfs.path = {hdfs dir}
a1.sinks.sink1.hdfs.fileSuffix = .avro
a1.sinks.sink1.hdfs.rollSize = 67108864
a1.sinks.sink1.hdfs.fileType = DataStream
问题是HDFS上的文件不是有效的AVRO文件!我正在使用hue UI检查文件是否是有效的AVRO文件 . 如果我将我在电脑上生成的AVRO I文件上传到集群,我可以看到它的内容很好 . 但来自水槽的文件不是有效的AVRO文件 .
我尝试了包含在水槽中但没有工作的水槽avro客户端,因为它每行发送一个水槽事件打破了avro文件,使用 deserializer = avro 修复了 spooldir 源 . 所以我认为在编写文件时问题出在HDFS接收器上 .
使用 hdfs.fileType = DataStream 它会从avro字段而不是整个avro文件中写入值,从而丢失所有架构信息 . 如果我使用 hdfs.fileType = SequenceFile ,文件由于某种原因无效 .
有任何想法吗?
谢谢