flume HDFS接收器自定义文件名

时间:2013-10-25 14:41:29

标签: java hadoop hdfs flume

有没有办法在flume存储的HDFS接收器中配置(动态通过Event)文件名? HDFS接收器提供以下名称配置。

hdfs.filePrefix
hdfs.fileSuffix

1 个答案:

答案 0 :(得分:1)

是。您可以通过以下参数在HDFS接收器中配置文件名。

hdfs.filePrefix = <<FILE_PREFIX>>-%{host}-%d-%H-%m-%s
hdfs.fileSuffix = <<FILE_SUFFIX>>-%{host}-%d-%H-%m-%s

%{host} = "It will pick up the hostname of your machine"
%t = "It will provide unix time in milliseconds "
%d= "Date"
%H= "Hour"
%m= "minutes"
%s= "seconds"

因此Flume Bucket writer打开hdfs写入的线程,使用“Prifix / Suffix”我们可以动态创建文件名。