Deploy replicat set

I don’t know what I am doing wrong. i’m following the steps " Chapter 2: Replicatio Setting Up a Replica Set"

Can anyone please provide clarity to the code


and this one


2 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”
Reset Workspace

Chapter 2: Replication Lab: Deploy a Replica Set

The correct syntax rs.add(hostname:port)

1 Like

They are all wrong. The syntax is

rs.add( "HostName:PortNumber" )

In all localhost is a well know host name and 27002 and 27003 are port number. In the context of the course we can recognized that m103 and m103-repl are replica set names. For the exercise the correct replica set name is m103-repl. The replica name is part of the configuration file (or command line argument) of mongod.

Since the test did FAIL with

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

then most likely you are missing rs.add() for that given host and port.

More details at:


Sorry @Ramachandra_Tummala, you posted a similar response while I was writing mine.


Ok thanks, I got it to work now. using:


The example steps in the previous lecture made it confusing

12 total, 12 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" [PASS] "The replica set 'm103-repl' contains localhost:27002" [PASS] "The replica set 'm103-repl' contains localhost:27003" [PASS] "The replica set enforces client authentication" [PASS] "The replica set m103-repl uses keyfile authentication"

**Reset Workspace**

Hi @Michael_Wenz,
Thanks for reporting this:

I will forward this feedback to the appropriate, team please be rest assured that our team will make the appropriate changes needed as soon as possible.

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer