Why when creating a cluster all replica set are running on same port 27017?
27017 is one of the default ports used by
Atlas uses ports from
27015 to 27017.
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.
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!
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?