Port 27017 for all replica sets

Why when creating a cluster all replica set are running on same port 27017?

Hi @Mohammad_Hussein,

27017 is one of the default ports used by mongod instance.

Atlas uses ports from 27015 to 27017.

~ Shubham

Aha okay, when i run rs.status() its shows that all 3 run using 27017, but it must be different shards right? then they are not running on the same host.

Hi @Mohammad_Husseinm,

shards are basically replica sets. You will learn more about sharding in M103 course.

I believe what you meant to say was that are they are running on different servers ? And, the answer is Yes.

If you look at the output of rs.status command and check the value of members.name field, you will see all member nodes of the replica set are running on different servers.

Hope it helps!

~ Shubham

Yup you’re right, they are running on different servers, but i have to ask you, isn’t replica set just mirroring of database, and each shard can have multiple replica set, why does atlas create a 1 instance under each shard?, i mean why not creating 3 replicas under the same shard? is that the best practice?