简体   繁体   English

在casbah中使用oplog监视类

[英]using the oplog monitoring class in casbah

I am trying to use the oplog monitoring class in casbah 我正在尝试在casbah中使用oplog监视类

https://github.com/mongodb/casbah/blob/master/casbah-core/src/main/scala/util/OpLog.scala 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 我想做的是在生产mongo db上监视oplog条目

 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. 我正在尝试构建一个scala应用程序来做到这一点。 Casbah the official scala driver for mongo as the above mentioned class which im trying to instantiate using Casbah是mongo的scala官方驱动程序,上述类是我试图实例化使用的类

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. 但是我什至无法实例化它,得到一个错误,即找不到mongooplog。 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. 我对Scala还是很陌生,因此进行一些详细的解释或包含它的链接对我会有所帮助。

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. 否则,MongoDB不会浪费CPU周期和磁盘空间来维护操作日志。 Please see the documentation on Replication for more info - http://www.mongodb.org/display/DOCS/Replication 请参阅有关复制的文档以了解更多信息-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 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM