MongoDb replica set: How to verify data replication on other servers

mongodbreplication

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…

Admin user not authorized

Edit 2:

enter image description here

Best Answer

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.