2016-05-13 216 views
0

我是Hadoop的新手,我正在使用Cloudera Quickstart,我想將flume與我的mongodb連接起來。我不知道如何將flume連接到已設置用戶名和密碼的mongoDB。我使用的源類型爲netcat,通道類型爲memory,接收器類型爲hdfs無法與mongodb連接flume

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 

回答

1

從你的問題,如果你真的想要寫的MongoDB或MongoDB的讀取我無法理解。

你想 到MongoDB的

我的情況下,你已經有了一個good starting point延長或開發你自己custom sink

在的情況下,你想從MongoDB的讀,則需要從頭開始實現的解決方案,下面就在Flume Developer Guide提及的實施例(可以重用一些代碼的部分從上面提供的GitHub鏈路)。

+0

我跟着這個鏈接,但我的mongodb受到用戶名和密碼的保護。所以我如何讀取受用戶名和密碼保護的我的mongodb,如果您請提供一些示例conf文件,它將有所幫助。 – Ironman

+0

如果您喜歡,請提出問題。 – Ironman