Test Results: [FAIL] The replica set 'm103-repl' contains localhost:27001

Hello, im having a problem to finish the lab “Deploy a Replica Set” because the results of the test tells me the following errors:

12 total, 9 passed, 0 skipped:
[PASS] “localhost:27001 is running”
[PASS] “localhost:27002 is running”
[PASS] “localhost:27003 is running”
[PASS] “Replication is enabled on localhost:27001”
[PASS] “Replication is enabled on localhost:27002”
[PASS] “Replication is enabled on localhost:27003”
[PASS] “Replica set ‘m103-repl’ has the correct name”
[FAIL] “The replica set ‘m103-repl’ contains localhost:27001”

Did you add ‘localhost:27001’ to the replica set ‘m103-repl’?

[FAIL] “The replica set ‘m103-repl’ contains localhost:27002”

Did you add ‘localhost:27002’ to the replica set ‘m103-repl’?

[FAIL] “The replica set ‘m103-repl’ contains localhost:27003”

Did you add ‘localhost:27003’ to the replica set ‘m103-repl’?

[PASS] “The replica set enforces client authentication”
[PASS] “The replica set m103-repl uses keyfile authentication”

Any suggestions please?

I suspect that the commands rs.initiate() and rs.add() have not been executed.

I did run the commands rs.initiate() and rs.add()but still getting the FAIL in the test, here is the result of the rs.status() command:

m103-repl:PRIMARY> rs.status()
{
“set” : “m103-repl”,
“date” : ISODate(“2020-12-11T22:18:56.220Z”),
“myState” : 1,
“term” : NumberLong(1),
“syncingTo” : “”,
“syncSourceHost” : “”,
“syncSourceId” : -1,
“heartbeatIntervalMillis” : NumberLong(2000),
“optimes” : {
“lastCommittedOpTime” : {
“ts” : Timestamp(1607725127, 1),
“t” : NumberLong(1)
},
“readConcernMajorityOpTime” : {
“ts” : Timestamp(1607725127, 1),
“t” : NumberLong(1)
},
“appliedOpTime” : {
“ts” : Timestamp(1607725127, 1),
“t” : NumberLong(1)
},
“durableOpTime” : {
“ts” : Timestamp(1607725127, 1),
“t” : NumberLong(1)
}
},
“lastStableCheckpointTimestamp” : Timestamp(1607725088, 1),
“members” : [
{
“_id” : 0,
“name” : “10.81.176.4:27001”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 400,
“optime” : {
“ts” : Timestamp(1607725127, 1),
“t” : NumberLong(1)
},
“optimeDate” : ISODate(“2020-12-11T22:18:47Z”),
“syncingTo” : “”,
“syncSourceHost” : “”,
“syncSourceId” : -1,
“infoMessage” : “”,
“electionTime” : Timestamp(1607724797, 2),
“electionDate” : ISODate(“2020-12-11T22:13:17Z”),
“configVersion” : 3,
“self” : true,
“lastHeartbeatMessage” : “”
},
{
“_id” : 1,
“name” : “m103.mongodb.university:27002”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 28,
“optime” : {
“ts” : Timestamp(1607725127, 1),
“t” : NumberLong(1)
},
“optimeDurable” : {
“ts” : Timestamp(1607725127, 1),
“t” : NumberLong(1)
},
“optimeDate” : ISODate(“2020-12-11T22:18:47Z”),
“optimeDurableDate” : ISODate(“2020-12-11T22:18:47Z”),
“lastHeartbeat” : ISODate(“2020-12-11T22:18:55.335Z”),
“lastHeartbeatRecv” : ISODate(“2020-12-11T22:18:54.387Z”),
“pingMs” : NumberLong(0),
“lastHeartbeatMessage” : “”,
“syncingTo” : “10.81.176.4:27001”,
“syncSourceHost” : “10.81.176.4:27001”,
“syncSourceId” : 0,
“infoMessage” : “”,
“configVersion” : 3
},
{
“_id” : 2,
“name” : “m103.mongodb.university:27003”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 8,
“optime” : {
“ts” : Timestamp(1607725127, 1),
“t” : NumberLong(1)
},
“optimeDurable” : {
“ts” : Timestamp(1607725127, 1),
“t” : NumberLong(1)
},
“optimeDate” : ISODate(“2020-12-11T22:18:47Z”),
“optimeDurableDate” : ISODate(“2020-12-11T22:18:47Z”),
“lastHeartbeat” : ISODate(“2020-12-11T22:18:55.343Z”),
“lastHeartbeatRecv” : ISODate(“2020-12-11T22:18:54.579Z”),
“pingMs” : NumberLong(0),
“lastHeartbeatMessage” : “”,
“syncingTo” : “10.81.176.4:27001”,
“syncSourceHost” : “10.81.176.4:27001”,
“syncSourceId” : 0,
“infoMessage” : “”,
“configVersion” : 3
}
],
“ok” : 1,
“operationTime” : Timestamp(1607725127, 1),
“$clusterTime” : {
“clusterTime” : Timestamp(1607725127, 1),
“signature” : {
“hash” : BinData(0,“LAPeSeKIOA2cRvNqK9gYdbC30P8=”),
“keyId” : NumberLong(“6905125428378206209”)
}
}
}

Yes I see that. Sorry. It done but with the wrong parameters. You must use the net.bindId and net.port specified in the configuration files.

Hi Steve, thanks for your answer, I have configured that parameters in the configuration files as i see in the previous lesson, like these (I only change storage.dbPath, net.port and systemLog.path between nodes):

It is correct?

storage:
dbPath: /var/mongodb/db/1
net:
bindIp: 10.81.176.4, localhost
port: 27001
security:
authorization: enabled
keyFile: /var/mongodb/pki/m103-keyfile
systemLog:
destination: file
path: /var/mongodb/logs/mongod1.log
logAppend: true
processManagement:
fork: true
replication:
replSetName: m103-repl

No it is not correct. 10.81.176.4 should not be there.

1 Like

Thank you Steve, I solved my problem, I was not seeing that the test requires the replica set nodes must be binded as localhost.

:stuck_out_tongue: