Hadoop flume将数据发布到HDFS,但存在字符问题

Hadoop flume将数据发布到HDFS,但存在字符问题,hadoop,flume,Hadoop,Flume,下面提到的是我的水槽配置 a1.sources = r1 a1.sinks = k1 a1.channels = c1 a1.sources.r1.type = http a1.sources.r1.port = 5140 a1.sources.r1.channels = c1 a1.sources.r1.handler = org.apache.flume.source.http.JSONHandler a1.sources.r1.handler.nickname = random prop

下面提到的是我的水槽配置

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

a1.sources.r1.type = http
a1.sources.r1.port = 5140
a1.sources.r1.channels = c1
a1.sources.r1.handler = org.apache.flume.source.http.JSONHandler
a1.sources.r1.handler.nickname = random props

a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

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

a1.sinks.k1.type = hdfs
a1.sinks.k1.channel = c1
a1.sinks.k1.hdfs.path = hdfs://10.0.40.18:9160/flume-test
a1.sinks.k1.hdfs.filePrefix = events-
a1.sinks.k1.hdfs.round = true
a1.sinks.k1.hdfs.roundValue = 10
a1.sinks.k1.hdfs.roundUnit = minute
flume日志文件中并没有错误,但在使用hadoop命令读取文件时出现问题

hadoop fs -cat hdfs://10.0.40.18:9160/flume-test/even1393415633931

flume log message is hdfs file created is "hdfs://10.0.40.18:9160/flume-test/even1393415633931"

任何有用的帮助。

首先,尝试用记录器替换HDFS接收器,看看输入是否正确到达

确认后,我建议尝试调整水槽的冲洗设置。HDFS接收器在通过
HDFS.batchSize
刷新到HDFS之前对事件进行批处理,默认情况下为
100
。这可能就是问题所在,因为在第一次刷新输出之前,您需要发送100篇JSON帖子


最后,您可能还想尝试调整
hdfs.writeFormat
,默认设置为
writeable
,而不是
Text
,听起来您想要一个文本文件,所以您应该像这样使用数据流:

a1.sinks.k1.hdfs.file.Type = DataStream

日志信息是什么。。请澄清。。不清楚frm ur问题HDFS文件写入是否成功。唯一的问题是使用hadoop fs的-cat命令无法显示字符。似乎是编码问题/设置。