2

テキスト ファイルをローカル フォルダーから hdfs に転送するように Flume を正常に構成しました。私の問題は、このファイルが hdfs に転送されるときに、不要なテキスト「hdfs.write.Longwriter + バイナリ文字」がテキスト ファイルの先頭に追加されることです。これが私のflume.confです

agent.sources = flumedump
agent.channels = memoryChannel
agent.sinks = flumeHDFS

agent.sources.flumedump.type = spooldir
agent.sources.flumedump.spoolDir = /opt/test/flume/flumedump/
agent.sources.flumedump.channels = memoryChannel

# Each sink's type must be defined
agent.sinks.flumeHDFS.type = hdfs
agent.sinks.flumeHDFS.hdfs.path = hdfs://bigdata.ibm.com:9000/user/vin
agent.sinks.flumeHDFS.fileType = DataStream

#Format to be written
agent.sinks.flumeHDFS.hdfs.writeFormat = Text

agent.sinks.flumeHDFS.hdfs.maxOpenFiles = 10
# rollover file based on maximum size of 10 MB
agent.sinks.flumeHDFS.hdfs.rollSize = 10485760

# never rollover based on the number of events
agent.sinks.flumeHDFS.hdfs.rollCount = 0

# rollover file based on max time of 1 mi
agent.sinks.flumeHDFS.hdfs.rollInterval = 60


#Specify the channel the sink should use
agent.sinks.flumeHDFS.channel = memoryChannel

# Each channel's type is defined.
agent.channels.memoryChannel.type = memory

# Other config values specific to each type of channel(sink or source)
# can be defined as well
# In this case, it specifies the capacity of the memory channel
agent.channels.memoryChannel.capacity = 100

私のソース テキスト ファイルは、テキストを含む非常に単純なものです。こんにちは、私の名前は Hadoop で、これがファイル 1 です。

hdfs で取得したシンク ファイルは次のようになります。 +こんにちは 私の名前は Hadoop で、これはファイル 1 です。

私が間違っていることを教えてください。

4

1 に答える 1

5

理解した。この行を修正する必要がありました

agent.sinks.flumeHDFS.fileType = DataStream

そしてそれをに変更します

agent.sinks.flumeHDFS.hdfs.fileType = DataStream

これで問題が解決しました。

于 2014-10-20T05:12:42.373 に答える