On this page
This tutorial describes the process for converting a sharded cluster to a non-sharded replica set. To convert a replica set into a sharded cluster Convert a Replica Set to a Sharded Cluster. See the Sharding documentation for more information on sharded clusters.
- Reconfigure the application to connect to the primary member of the replica set hosting the single shard that system will be the new replica set.
The single-shard cluster is now a non-sharded replica set that will accept read and write operations on the data set.
You may now decommission the remaining sharding infrastructure.
- With the sharded cluster running, deploy a new replica set in addition to your sharded cluster. The replica set must have sufficient capacity to hold all of the data files from all of the current shards combined. Do not configure the application to connect to the new replica set until the data transfer is complete.
- Stop all writes to the sharded cluster. You may reconfigure
your application or stop all
mongosinstances. If you stop all
mongosinstances, the applications will not be able to read from the database. If you stop all
mongosinstances, start a temporary
mongosinstance on that applications cannot access for the data migration procedure.
Not all collections on all databases are necessarily sharded. Do not solely migrate the sharded collections. Ensure that all databases and all collections migrate correctly.
- Reconfigure the application to use the non-sharded replica set instead of the
The application will now use the un-sharded replica set for reads and writes. You may now decommission the remaining unused sharded cluster infrastructure.