无法将 flume 连接到 mongodb

Unable to connect flume with mongodb

我是 Hadoop 的新手,我正在使用 Cloudera Quickstart and I want to connect flume 和我的 mongodb。我不知道如何将 flume 连接到已设置用户名和密码的 mongoDB。我将源类型用作 netcat,将通道类型用作 memory,将接收器类型用作 hdfs

我的flume.conf文件

# Please paste flume.conf here. Example:
# Sources, channels, and sinks are defined per
# agent name, in this case 'tier1'.
tier1.sources  = source1
tier1.channels = channel1
tier1.sinks    = sink1
# For each source, channel, and sink, set
# standard properties.
tier1.sources.source1.type     = netcat
tier1.sources.source1.bind     = 192.168.x.xxx
tier1.sources.source1.port     = 27017
tier1.sources.source1.channels = channel1
tier1.channels.channel1.type   = memory
tier1.sinks.sink1.type         = hdfs
tier1.sinks.sink1.hdfs.path    = /user/cloudera/flume
tier1.sinks.sink1.hdfs.fileType = DataStream
tier1.sinks.sink1.channel      = channel1

# Other properties are specific to each type of
# source, channel, or sink. In this case, we
# specify the capacity of the memory channel.
tier1.channels.channel1.capac

如果你真的想写入 MongoDB 或从 MongoDB 读取,我无法理解你的问题。

如果您想 写入 MongoDB,您已经有 good starting point to extend or develop you own custom sink.

如果您想从 MongoDB 中 阅读 ,您将需要按照 Flume Developer Guide 中提到的示例从头开始实施解决方案](您可以重用上面提供的 GitHub link 中的部分代码)。