Unable to reach primary for set m103-example

Hi - in the Lab: Deploy a Replica Set, I had issues connecting to a mongodb node, but figured out a solution; see below error and after that I have listed command which is not working (I thought this should work or that is what taught in the course) and the one that is working. Any ideas?

2020-08-22T15:34:13.702+0000 W NETWORK [js] Unable to reach primary for set m103-example
2020-08-22T15:34:14.203+0000 W NETWORK [js] node: localhost:27002 isn’t a part of set: m103-example ismaster: { hosts: [ “localhost:27002” ], setName: “m103-repl”, setVersion: 1, ismaster: true, secondary: false, primary: “localhost:27002”, me: “localhost:27002”, electionId: ObjectId(‘7fffffff0000000000000001’), lastWrite: { opTime: { ts: Timestamp(1598110443, 3), t: 1 }, lastWriteDate: new Date(1598110443000), majorityOpTime: { ts: Timestamp(1598110443, 3), t: 1 }, majorityWriteDate: new Date(1598110443000) }, maxBsonObjectSize: 16777216, maxMessageSizeBytes: 48000000, maxWriteBatchSize: 100000, localTime: new Date(1598110454202), logicalSessionTimeoutMinutes: 30, minWireVersion: 0, maxWireVersion: 7, readOnly: false, ok: 1.0, operationTime: Timestamp(1598110443, 3), $clusterTime: { clusterTime: Timestamp(1598110443, 3), signature: { hash: BinData(0, ED282C329A5E88116C57C436C2408583C85B311D), keyId: 6863831748778655745 } } }

Command not working:

mongo --host "m103-example/192.168.103.100:27011" -u "m103-admin" -p "m103-pass" --authenticationDatabase "admin"

Command working:

mongo --port 27002 -u "m103-admin" -p "m103-pass" --authenticationDatabase "admin"

Hi @Shravan,

Do you have any node running on port 27011 ?

Did you add the node running on port 27002 to the replica set ? Is it running ?

~ Shubham

Thanks for your reply @Shubham_Ranjan.

node is running on port 27002, looks like I have referenced an incorrect port in my post, even with correct port, like below, am unable to connect, it just keeping complaining the node is not part of the replication set:

mongo --host "m103-example/localhost:27002" -u "m103-admin" -p "m103-pass" --authenticationDatabase "admin"

to connect you have to use the working command I have referenced in my post.

Do you think above command isn’t correct or there is some other problem. Please note that my lab has passed the tests.

Hi @Shravan,

As per the requirements mentioned in the lab, the name of the replica set should be m103-repl.

~ Shubham

Okay, thanks for pointing that out Shubham.