Hadoop MR ジョブへの入力として、MongoDB 内のデータベースのすべてのコレクションを渡す必要があります。複数の入力を許可する方法があります。
MultiCollectionSplitBuilder mcsb = new MultiCollectionSplitBuilder();
mcsb.add(new MongoURI("mongodb://localhost:27017/mongo_hadoop.yield_historical.in"),
(MongoURI)null, // authuri
true, // notimeout
(DBObject)null, // fields
(DBObject)null, // sort
(DBObject)null, // query
false,
MultiMongoCollectionSplitter.class)
.add(new MongoURI("mongodb://localhost:27017/mongo_hadoop.yield_historical.in"),
(MongoURI)null, // authuri
true, // notimeout
(DBObject)null, // fields
(DBObject)null, // sort
new BasicDBObject("_id", new BasicDBObject("$gt", new Date(883440000000L))),
false, // range query
MultiMongoCollectionSplitter.class);
しかし、データベースには約10個のコレクションがあります。上記のメソッドでは、2 つのコレクション引数のみが許可されます。私がする必要があるのは、すべてのコレクションをマッパー メソッドだけで取得することだけです。私のレデューサーは、それらすべてで同じになります。
どんな助けでも大歓迎です。