Lab: Deploy a Replica Set

Hi,
Here is the status of the replica set, which seems correct to me. But the Test runs false.

Thanks for your help,
Farouk.

Test Result
[FAIL] “The replica set ‘m103-repl’ contains localhost:27002”
(in test file /tmp/eval.sh, line 109)
`[[ ! $localhost_27002_member != “notjoined” ]]’ failed

  • have you added ‘localhost:27002’ to the replica set ‘m103-repl’?
    [FAIL] “The replica set ‘m103-repl’ contains localhost:27003”
    (in test file /tmp/eval.sh, line 121)
    `[[ ! $localhost_27003_member != “notjoined” ]]’ failed

  • have you added ‘localhost:27003’ to the replica set ‘m103-repl’?

rs.status()
{
“set” : “m103-repl”,
“date” : ISODate(“2020-05-07T22:53:07.543Z”),
“myState” : 1,
“term” : NumberLong(1),
“syncingTo” : “”,
“syncSourceHost” : “”,
“syncSourceId” : -1,
“heartbeatIntervalMillis” : NumberLong(2000),
“optimes” : {
“lastCommittedOpTime” : {
“ts” : Timestamp(1588891985, 1),
“t” : NumberLong(1)
},
“readConcernMajorityOpTime” : {
“ts” : Timestamp(1588891985, 1),
“t” : NumberLong(1)
},
“appliedOpTime” : {
“ts” : Timestamp(1588891985, 1),
“t” : NumberLong(1)
},
“durableOpTime” : {
“ts” : Timestamp(1588891985, 1),
“t” : NumberLong(1)
}
},
“lastStableCheckpointTimestamp” : Timestamp(1588891935, 1),
“members” : [
{
“_id” : 0,
“name” : “localhost:27001”,
“health” : 1,
“state” : 1,
“stateStr” : “PRIMARY”,
“uptime” : 500,
“optime” : {
“ts” : Timestamp(1588891985, 1),
“t” : NumberLong(1)
},
“optimeDate” : ISODate(“2020-05-07T22:53:05Z”),
“syncingTo” : “”,
“syncSourceHost” : “”,
“syncSourceId” : -1,
“infoMessage” : “”,
“electionTime” : Timestamp(1588891514, 2),
“electionDate” : ISODate(“2020-05-07T22:45:14Z”),
“configVersion” : 3,
“self” : true,
“lastHeartbeatMessage” : “”
},
{
“_id” : 1,
“name” : “localhost:27002”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 163,
“optime” : {
“ts” : Timestamp(1588891985, 1),
“t” : NumberLong(1)
},
“optimeDurable” : {
“ts” : Timestamp(1588891985, 1),
“t” : NumberLong(1)
},
“optimeDate” : ISODate(“2020-05-07T22:53:05Z”),
“optimeDurableDate” : ISODate(“2020-05-07T22:53:05Z”),
“lastHeartbeat” : ISODate(“2020-05-07T22:53:06.272Z”),
“lastHeartbeatRecv” : ISODate(“2020-05-07T22:53:07.288Z”),
“pingMs” : NumberLong(0),
“lastHeartbeatMessage” : “”,
“syncingTo” : “localhost:27001”,
“syncSourceHost” : “localhost:27001”,
“syncSourceId” : 0,
“infoMessage” : “”,
“configVersion” : 3
},
{
“_id” : 2,
“name” : “localhost:27003”,
“health” : 1,
“state” : 2,
“stateStr” : “SECONDARY”,
“uptime” : 113,
“optime” : {
“ts” : Timestamp(1588891985, 1),
“t” : NumberLong(1)
},
“optimeDurable” : {
“ts” : Timestamp(1588891985, 1),
“t” : NumberLong(1)
},
“optimeDate” : ISODate(“2020-05-07T22:53:05Z”),
“optimeDurableDate” : ISODate(“2020-05-07T22:53:05Z”),
“lastHeartbeat” : ISODate(“2020-05-07T22:53:06.272Z”),
“lastHeartbeatRecv” : ISODate(“2020-05-07T22:53:07.514Z”),
“pingMs” : NumberLong(0),
“lastHeartbeatMessage” : “”,
“syncingTo” : “localhost:27001”,
“syncSourceHost” : “localhost:27001”,
“syncSourceId” : 0,
“infoMessage” : “”,
“configVersion” : 3
}
],
“ok” : 1,
“operationTime” : Timestamp(1588891985, 1),
“$clusterTime” : {
“clusterTime” : Timestamp(1588891985, 1),
“signature” : {
“hash” : BinData(0,“tUumMNt8bRa3UJHt7k36T9j5Ypw=”),
“keyId” : NumberLong(“6824237093816893441”)
}
}
}

rs.isMaster()
{
“hosts” : [
“localhost:27001”,
“localhost:27002”,
“localhost:27003”
],
“setName” : “m103-repl”,
“setVersion” : 3,
“ismaster” : true,
“secondary” : false,
“primary” : “localhost:27001”,
“me” : “localhost:27001”,
“electionId” : ObjectId(“7fffffff0000000000000001”),
“lastWrite” : {
“opTime” : {
“ts” : Timestamp(1588892315, 1),
“t” : NumberLong(1)
},
“lastWriteDate” : ISODate(“2020-05-07T22:58:35Z”),
“majorityOpTime” : {
“ts” : Timestamp(1588892315, 1),
“t” : NumberLong(1)
},
“majorityWriteDate” : ISODate(“2020-05-07T22:58:35Z”)
},
“maxBsonObjectSize” : 16777216,
“maxMessageSizeBytes” : 48000000,
“maxWriteBatchSize” : 100000,
“localTime” : ISODate(“2020-05-07T22:58:41.556Z”),
“logicalSessionTimeoutMinutes” : 30,
“minWireVersion” : 0,
“maxWireVersion” : 7,
“readOnly” : false,
“ok” : 1,
“operationTime” : Timestamp(1588892315, 1),
“$clusterTime” : {
“clusterTime” : Timestamp(1588892315, 1),
“signature” : {
“hash” : BinData(0,“DdFok0yGdzlGe/F6uTcv1XHJeqg=”),
“keyId” : NumberLong(“6824237093816893441”)
}
}
}

What are the lab requirements?
Normally your replicaset is binded to localhost and an IP

Please share your config file/lab description just for bindIP

getting similar issue …

Test Result:

12 total, 10 passed, 0 skipped:
[PASS] "localhost:27001 is running"
[PASS] "localhost:27002 is running"
[PASS] "localhost:27002 is running"
[PASS] "Replication is enabled on localhost:27001"
[PASS] "Replication is enabled on localhost:27002"
[PASS] "Replication is enabled on localhost:27003"
[PASS] "The replica set 'm103-repl' contains localhost:27001"
[FAIL] "The replica set 'm103-repl' contains localhost:27002"
(in test file /tmp/eval.sh, line 109)
`[[ ! $localhost_27002_member != "notjoined" ]]' failed

- have you added 'localhost:27002' to the replica set 'm103-repl'?
[FAIL] "The replica set 'm103-repl' contains localhost:27003"
(in test file /tmp/eval.sh, line 121)
`[[ ! $localhost_27003_member != "notjoined" ]]' failed

- have you added 'localhost:27003' to the replica set 'm103-repl'?
[PASS] "The replica set enforces client authentication"
[PASS] "The user m103-admin was created with the right password"
[PASS] "The replica set m103-repl uses keyfile authentication"


m103-repl:PRIMARY> rs.status()
{
        "set" : "m103-repl",
        "date" : ISODate("2020-05-08T10:27:46.143Z"),
        "myState" : 1,
        "term" : NumberLong(7),
        "syncingTo" : "",
        "syncSourceHost" : "",
        "syncSourceId" : -1,
        "heartbeatIntervalMillis" : NumberLong(2000),
        "optimes" : {
                "lastCommittedOpTime" : {
                        "ts" : Timestamp(1588933662, 1),
                        "t" : NumberLong(7)
                },
                "readConcernMajorityOpTime" : {
                        "ts" : Timestamp(1588933662, 1),
                        "t" : NumberLong(7)
                },
                "appliedOpTime" : {
                        "ts" : Timestamp(1588933662, 1),
                        "t" : NumberLong(7)
                },
                "durableOpTime" : {
                        "ts" : Timestamp(1588933662, 1),
                        "t" : NumberLong(7)
                }
        },
        "lastStableCheckpointTimestamp" : Timestamp(1588933612, 1),
        "members" : [
                {
                        "_id" : 0,
                        "name" : "localhost:27001",
                        "health" : 1,
                        "state" : 1,
                        "stateStr" : "PRIMARY",
                        "uptime" : 288,
                        "optime" : {
                                "ts" : Timestamp(1588933662, 1),
                                "t" : NumberLong(7)
                        },
                        "optimeDate" : ISODate("2020-05-08T10:27:42Z"),
                        "syncingTo" : "",
                        "syncSourceHost" : "",
                        "syncSourceId" : -1,
                        "infoMessage" : "",
                        "electionTime" : Timestamp(1588933390, 1),
                        "electionDate" : ISODate("2020-05-08T10:23:10Z"),
                        "configVersion" : 7,
                        "self" : true,
                        "lastHeartbeatMessage" : ""
                },
                {
                        "_id" : 1,
                        "name" : "localhost:27002",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 279,
                        "optime" : {
                                "ts" : Timestamp(1588933662, 1),
                                "t" : NumberLong(7)
                        },
                        "optimeDurable" : {
                                "ts" : Timestamp(1588933662, 1),
                                "t" : NumberLong(7)
                        },
                        "optimeDate" : ISODate("2020-05-08T10:27:42Z"),
                        "optimeDurableDate" : ISODate("2020-05-08T10:27:42Z"),
                        "lastHeartbeat" : ISODate("2020-05-08T10:27:44.863Z"),
                        "lastHeartbeatRecv" : ISODate("2020-05-08T10:27:45.336Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "",
                        "syncingTo" : "localhost:27001",
                        "syncSourceHost" : "localhost:27001",
                        "syncSourceId" : 0,
                        "infoMessage" : "",
                        "configVersion" : 7
                },
                {
                        "_id" : 2,
                        "name" : "localhost:27003",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 273,
                        "optime" : {
                                "ts" : Timestamp(1588933662, 1),
                                "t" : NumberLong(7)
                        },
                        "optimeDurable" : {
                                "ts" : Timestamp(1588933662, 1),
                                "t" : NumberLong(7)
                        },
                        "optimeDate" : ISODate("2020-05-08T10:27:42Z"),
                        "optimeDurableDate" : ISODate("2020-05-08T10:27:42Z"),
                        "lastHeartbeat" : ISODate("2020-05-08T10:27:44.863Z"),
                        "lastHeartbeatRecv" : ISODate("2020-05-08T10:27:45.695Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "",
                        "syncingTo" : "localhost:27001",
                        "syncSourceHost" : "localhost:27001",
                        "syncSourceId" : 0,
                        "infoMessage" : "",
                        "configVersion" : 7
                }
        ],
        "ok" : 1,
        "operationTime" : Timestamp(1588933662, 1),
        "$clusterTime" : {
                "clusterTime" : Timestamp(1588933662, 1),
                "signature" : {
                        "hash" : BinData(0,"LvLr6SgtXzMqiQ65XAEx1HXlrOo="),
                        "keyId" : NumberLong("6824411426539438081")
                }
        }
}

configuration for 27002

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

May be bug in the validation script
Shubham_Ranjan is looking into it

Error in validation script - Lab: Deploy a Replica Set

1 Like

Hi,

I tried another time today and cannot pass the test.
See attached the conf files and result.

Best regards,
Farouk.

mongod_1conf.txt (325 Bytes) mongod_2conf.txt (323 Bytes) mongod_3conf.txt (323 Bytes) status and ismaster.txt (6.7 KB) test result.txt (1006 Bytes)

Seems some bug with validation script
Please check this link

[Issue with the test suite] Lab: Deploy a Replica Set

Hi @Ke_Wei_Tan and @Farouk_BERROUBA ,

We are currently working on fixing the issue in this lab. It will be fixed within 24 hours. Thanks for your patience.

~ Shubham

Hi @Farouk_BERROUBA and @Ke_Wei_Tan,

The issue has been resolved. You can complete this lab now. Please let me know if you still face any issue.

~ Shubham

Shubham,

I’m still facing the same issue!!!

because there are 3 or 4 different issues in this thread.

Please post your issue in a new thread and make sure to include a screenshot of what you are doing that shows the issue you are getting.

Below is the output i’m getting:

12 total, 10 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”
[PASS] “The replica set ‘m103-repl’ contains localhost:27001”
[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”

When i try to add other 2 replica set using the below query… I’m getting below error message:
m103-repl:PRIMARY> rs.add(“m103/localhost:27002”)
{
“operationTime” : Timestamp(1602656266, 1),
“ok” : 0,
"errmsg" : “Either all host names in a replica set configuration must be localhost references, or none must be; found 1 out of 2”,
“code” : 103,
“codeName” : “NewReplicaSetConfigurationIncompatible”,
“$clusterTime” : {
“clusterTime” : Timestamp(1602656266, 1),
“signature” : {
“hash” : BinData(0,“howYYD78W6iOSGd4qzLbuK8iAo8=”),
“keyId” : NumberLong(“6883354316464193538”)
}
}
}

Please check syntax of rs.add()
It should be like rs.add(“host:port”)

@Ramachandra_37567,

As suggested… ran the below query still getting the same error message:

m103-repl:PRIMARY> rs.add(“m103:27002”)
{
“operationTime” : Timestamp(1602741001, 1),
“ok” : 0,
“errmsg” : “Either all host names in a replica set configuration must be localhost references, or none must be; found 1 out of 2”,
“code” : 103,
“codeName” : “NewReplicaSetConfigurationIncompatible”,
“$clusterTime” : {
“clusterTime” : Timestamp(1602741001, 1),
“signature” : {
“hash” : BinData(0,“n2D4hCrrjrqo3AcSGWotlr79dDs=”),
“keyId” : NumberLong(“6883719152461152257”)
}
}
}
m103-repl:PRIMARY>

Even tried below query:
rs.add(“m103-repl:27002”)

Getting the same error message

Is m103 your hostname?
Syntax still not correct
Just add this way

rs.add(“localhost:27002”)

@Ramachandra_37567 it worked… Thank you:)