HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

MongoDb replica set: How do I verify data replication on other servers?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
serversreplicamongodbverifyreplicationhowotherdataset

Problem

I have a 3 member replica set running. It's geo-located on 3 separate VPSs. On primary I can do rs.status() and see it's working. I can't execute any mongo shell commands on the secondaries. How do I verify data replication on other servers? I see nothing indicating data being copied in the logs.

Thanks a lot for any help :-)

Edit 1:

Tried db.printSlaveReplicationInfo(). Logged in as user with full admin role...



Edit 2:

Solution

For querying secondary run the following command first. After running this, you can do all regular stuff on secondary.

rs.slaveOk()


To see the replication status, run the following command on primary. This will show you if the secondaries are up to date or lagging.

db.printSlaveReplicationInfo()


Hope this helps.

Code Snippets

rs.slaveOk()
db.printSlaveReplicationInfo()

Context

StackExchange Database Administrators Q#100438, answer score: 5

Revisions (0)

No revisions yet.