flume hdfs sink自定义文件名

9udxz4iz  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(600)

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

hdfs.filePrefix
hdfs.fileSuffix
bis0qfac

bis0qfac1#

对。您可以通过以下参数配置hdfs sink中的文件名。

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/后缀”,我们可以动态创建文件名。

相关问题