hadoop - 文件分成许多部分

标签 hadoop flume flume-ng

嗨,我正在尝试通过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/

相关文章:

hadoop - Pig XMLLoader:无法解析XML(转换为CSV)

hadoop - Hive 外部表不显示任何内容

hdfs - Cloudera 5.4.2 : Avro block size is invalid or too large when using Flume and Twitter streaming

hadoop - 百万歌曲数据集是否以 .tsv 或 .csv 格式提供?

java - 我正在org.apache.hadoop.ipc.RemoteException:Mapreduce作业中的java.io.IOException?

flume - 在 flume.conf 中获取变量

hadoop - 如何配置 Flume 来监听 web api http 请求

hadoop - 如何使用Apache Flume过滤多个源数据?

java - 我的 hadoop 代码从未进入键值测试

linux - Flume 在 Linux 中运行失败