Replica Set login locality clarification

So it was mentioned in Chapter 2, Lecture 3 that when connecting to the Replica Set using the “<replset_name>/HOST:PORT” format of the “–host” paramter in the mongo connection string that it knows we’re trying to login to the replica set, so the mongod takes care of routing our client login request to whichever node is the acting PRIMARY in the Replica Set. If that is true, then when you run a command like rs.printReplicationInfo(), which states that it returns opLog info for only the node you’re connected to, then how can you ever retrieve command output relevant to Replica Set SECONDARY for that command, since logging into the set always redirects your connection to the PRIMARY for the set?

My guess is that the answer is that for the rs.printReplicationInfo() command, you need to login to the actual mongod for one of the SECONDARIES instead of the to the replication set…but just thought I’d ask for clarity, and for just doing a first post to the forums. :slight_smile: Thanks in advance for any comment.


No need to reply, I have confirmed that what I stated at the end is the case: connecting to the secondary node’s mongod daemon directly is how you get node-relevant output for commands such as rs.printReplicationInfo().

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.