Converting a Replica Set to a Sharded Cluster

MongoDB

#Cloud

We are excited to announce that Cloud Manager now supports converting a replica set to a sharded cluster via Automation. This oft-requested feature will help you scale your deployment more easily. Here’s how:

  1. Head to your Deployment Page and use the “…” menu for an existing replica set to choose “Convert to Sharded Cluster”
    https://webassets.mongodb.com/_com_assets/blog/tblr/36.media.tumblr.com--d43504e72c301c40f4bafe2004c66d36--tumblr_o366jq7Vaw1sdaytmo1_1280.png
  2. Enter in the requested details, like which hosts you want your mongoSes and config servers to be deployed on and on what ports.
    https://webassets.mongodb.com/_com_assets/blog/tblr/36.media.tumblr.com--bd7749062d61172fab73c82141559ebd--tumblr_o366jq7Vaw1sdaytmo2_1280.png
  3. Click “Next” and then you can drag and drop processes as needed to tweak your deployment.
  4. Push “Review and Deploy” and then “Confirm and Deploy”
  5. Modify your application to reach out to the mongoSes rather than the replica set

Cloud Manager Automation has now converted your replica set to a sharded cluster. This does not mean that all of your collections and databases are sharded, though. Cloud Manager Automation does not issue enableSharding or shardCollection commands to activate sharding for particular databases and collections, so issuing these and choosing a suitable shard key are left to you. Otherwise, you’re good to go, including adding additional shards via the wrench menu, if necessary.