سؤال

I am trying to use the oplog monitoring class in casbah

https://github.com/mongodb/casbah/blob/master/casbah-core/src/main/scala/util/OpLog.scala

What i want to do is monitor the oplog entries at a production mongo db on

 production.someserver.com

and get the entries and send them to the storage DB at

 test.someotherserver.com

and replicate all the data that is in the production server to the test server. I cannot use replica sets to do this as i cannot redeploy now. I am trying to build a scala app to do this. Casbah the official scala driver for mongo as the above mentioned class which i m trying to instantiate using

val mongoColl = MongoConnection() ("test") ("test_data")
val oLog = new MongoOpLog(mongoColl)

But im not even able to instantiate it, getting an error that mongooplog is not found. Ive imported the necessary package. But even if im able to do this i have no clue on how to do what i want to do. can any one pls point me in a right direction on how to achieve this. I am pretty new to scala so a bit of detailed explanation or a link containing it would be helpful for me.

هل كانت مفيدة؟

المحلول

You need to have replication enabled on the server for the oplog to be created; as either a member of a replica set or in master mode for master/slave.

Otherwise, MongoDB does not waste CPU cycles and disk space maintaining an oplog. Please see the documentation on Replication for more info - http://www.mongodb.org/display/DOCS/Replication

You should really never be running any database with a single server in production, incidentally.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top