0

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.

swordfish
  • 4,899
  • 5
  • 33
  • 61

1 Answers1

1

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.

Brendan W. McAdams
  • 9,379
  • 3
  • 41
  • 31
  • The oplog is already created, and its working fine. I just need to know how i can monitor it programatically using scala and casbah, i have no idea on how to use the oplog monitoring class to do what i need, i have clearly explained what i need to do. – swordfish Jul 25 '11 at 12:31
  • You need to paste the entire error message you are getting then. My confusion comes from you saying " getting an error that mongooplog is not found " which is a message I do spit out from the class when I cannot find the oplog. Additionally, the first argument to MongoOpLog is a CONNECTION, not a Collection, which you are passing in. – Brendan W. McAdams Jul 25 '11 at 18:08
  • No the error is flagged by the IDE. im using IntelliJ IDEA and while compiling itself im getting the error that the class mongooplog is not found. – swordfish Jul 26 '11 at 08:45
  • which method should i call to start monitoring the oplog in the oplog monitor and how do i get the record that is writen to the oplog – swordfish Jul 27 '11 at 07:04