嗨,我正在尝试通过flume将本地文件系统中的csv文件加载到HDFS文件系统中。我只有一个要解析的文件。文件大小小于5mb,但是在flume上解析时它分成了很多部分。我的水槽。
FileAgent.sources = tail
FileAgent.channels = Channel-2
FileAgent.sinks = HDFS
FileAgent.sources.tail.type = exec
FileAgent.sources.tail.command = cat /tmp/flumeSpool/2.csv
FileAgent.sources.tail.channels = Channel-2
FileAgent.sinks.HDFS.type = hdfs
FileAgent.sinks.HDFS.hdfs.path = hdfs://127.0.0.1:54310/
FileAgent.sinks.HDFS.hdfs.fileType = DataStream
FileAgent.sinks.HDFS.channel = Channel-2
FileAgent.channels.Channel-2.type = file
FileAgent.channels.Channel-2.capacity = 100000
FileAgent.channels.Channel-2.transactionCapacity = 80000
FileAgent.sinks.HDFS.hdfs.writeFormat = Text
FileAgent.sinks.k1.hdfs.rollSize = 10485760
FileAgent.sinks.k1.hdfs.rollCount = 0
FileAgent.sinks.k1.hdfs.rollInterval = 300
任何帮助将不胜感激。
最佳答案
您在flume conf文件本身中犯了错误。
FileAgent.sinks.HDFS.hdfs.writeFormat = Text
FileAgent.sinks.k1.hdfs.rollSize = 10485760
FileAgent.sinks.k1.hdfs.rollCount = 0
FileAgent.sinks.k1.hdfs.rollInterval = 300
在开始时将其定义为HDFS时,将接收器名称指定为k1。
重写如下:
FileAgent.sinks.HDFS.hdfs.writeFormat = Text
FileAgent.sinks.HDFS.hdfs.rollSize = 10485760
FileAgent.sinks.HDFS.hdfs.rollCount = 0
FileAgent.sinks.HDFS.hdfs.rollInterval = 300
由于名称错误,接收器将采用以下配置的默认值:
卷大小= 1024(字节)
掷骰= 10(事件)
因此有许多文件。
(如果k1是同一conf文件中的其他接收器,则还要提及HDFS接收器的所有这些参数)
关于hadoop - 文件分成许多部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44406392/