how to initiate and maintain mongo shard replica set from mongos server? [closed]

I am trying to initiate a mongo shards replica set from mongos server, I want my mongos to maintain replica set and able to add new server to replication if needed.


If you are trying to add a new shard to an existing cluster, you need to first create the replica set for the shard. As at MongoDB 3.6, you cannot run replica set management commands such as rs.initiate() or rs.add() via mongos: these commands need to be sent to the current primary for the replica set.

Once a new shard is successfully added to a deployment, the sharded cluster balancer will automatically take care of redistributing sharded collections to factor in the availability of the additional shard.

Source : Link , Question Author : siva nagi reddy , Answer Author : Stennie

Leave a Comment