|
The Mongo database supports replication of data between servers. The replication is an enhanced master-slave configuration: that is, only one server is active for writes (the master) at a given time. The primary goal of replication is failover and redundancy. Mongo supports two forms of replication: simple master-slave configurations, and additionally a replica pair concept. Please see the following pages for more details: SecurityWhen security is enabled, one must configure a user account for the local database that exists on both servers. The slave-side of a replication connection first looks for a user repl in local.system.users. If present, that user is used to authenticate against the local database on the source side of the connection. If repl user does not exist, the first user object in local.system.users is tried. The local database works like the admin database: an account for local has access to the entire server. DiagnosticsFrom the shellCheck master status from the mongo shell with: // inspects contents of local.oplog.$main on master and reports status:
db.printReplicationInfo()
Check slave status from the mongo shell with: // inspects contents of local.sources on the slave and reports status:
db.printSlaveReplicationInfo()
(Note you can evaluate the above functions without the parenthesis above to see their javascript source and a bit on the internals.) As of 1.3.2, you can do this on the slave db._adminCommand( { serverStatus : 1 , repl : N } )
N is the level of diagnostic information and can have the following values:
Http InterfaceThe administrative Http Interace (at port 28017) provides some basic status information on either a master or slave mongod process. replInfo: repl: sleep 2sec before next pass replication master: 0 slave: 1 initialSyncCompleted: 1 OptionsSlave DelaySometimes its beneficial to have a slave that is purposefully many hours behind to prevent human error. In MongoDB 1.3.3+, you can specify this with the --slavedelay mongod command line option: --slavedelay arg specify delay (in seconds) to be used when applying
master ops to slave
See Also |

IF YOU HAVE A QUESTION, POST IT TO THE USER GROUP.
These pages are fine for comments, but for questions, your best bet will always be the MongoDB User Group. blog comments powered by Disqus