Docs Menu

Docs HomeMongoDB Cloud Manager

Convert a Replica Set to a Sharded Cluster

On this page

  • Navigate to the Clusters view for your deployment.
  • Convert your desired replica set.
  • Provide Details for your New Sharded Cluster.
  • Click Convert.
  • Modify your Application to Connect to the mongos Processes Instead of the Replica Set.
  • Change any Cluster-Wide Settings.

Cloud Manager provides the ability to convert a replica set to a sharded cluster.

1
  1. If it is not already displayed, select the organization that contains your desired project from the Organizations menu in the navigation bar.

  2. If it is not already displayed, select your desired project from the Projects menu in the navigation bar.

  3. If it is not already displayed, click Deployment in the sidebar.

  1. Click the Clusters view.

2

From the menu on the desired replica set, click Convert to Sharded Cluster.

3

Configure the following settings in the Provide details for your new sharded cluster modal:

  1. Name your sharded cluster components:

    Field
    Action
    Cluster Name
    Type the name of your new cluster.
    CSRS Name (MongoDB 3.2 or later)
    Type the name of the CSRS.

    Note

    You cannot change these values after you click Convert.

  2. Set the following values for each ~bin.mongod process in your Config Servers. All fields are required.

    Note

    You must deploy at least one configuration server.

    Field
    Action
    Host Name

    From the menu, select an existing hostname or type a hostname in the search box above the list to find a host.

    If you need to add a new host:

    1. Click the New Server link.

    2. Click Next.

    3. Follow the instructions to install a new Automation on that new host.

    4. Click Verify Agent.

    Port
    Type the IANA port number.
    Data Directory

    Type the absolute directory path to the database files for each ~bin.mongod.

    The example path is /data.

    The ~bin.mongod must have exclusive use of these paths on the specified host. The Cloud Manager Automation must have file system permission to read, write, and execute all files and folders in this directory.

    Log File

    Type the absolute file path for the log file for each ~bin.mongod.

    The example path is /data/mongodb.log.

    The ~bin.mongod must have exclusive use of these paths on the specified host. The Cloud Manager Automation must have file system permission to read, write, and execute all files and folders in this directory.

    Note

    Adding or Removing Config Servers

    • To add a new configuration server, click Add a Config Server.

    • To remove a config server, click to the right of the config server you want to remove.

  3. Set the following values for each MongoS process in your sharded cluster. All fields are required.

    Note

    You must deploy at least one mongos.

    Field
    Action
    Host Name

    From the menu, select an existing hostname or type a hostname in the search box above the list to find a host.

    If you need to add a new host:

    1. Click the New Server link.

    2. Click Next.

    3. Follow the instructions to install a new Automation on that new host.

    4. Click Verify Agent.

    Port
    Type the IANA port number.
    Log File

    Type the abolute file path for the log of each mongos process.

    The example path is /data/mongodb.log.

    The mongos must have exclusive use of these paths on the specified host. The Cloud Manager Automation must have file system permission to read, write, and execute all files and folders in this directory.

    Note

    Adding or Removing Mongo Shard Routers

    • To add a new mongos, click Add a MongoS.

    • To remove a mongos, click to the right of the mongos you want to remove.

4
5

From the Cloud Manager UI, click the icon, then click Connect to this instance. The Connect to your Deployment dialog provides the hostname and port of a mongos in the cluster.

For complete documentation on connecting to an Cloud Manager deployment, see Connect to a MongoDB Process

6

If you want to make any further changes to the sharded cluster, see the Sharded Cluster tab on the Edit a Deployment's Configuration page.

After you convert a replica set to a sharded cluster, you can enable sharding for a database and shard collections.

To learn how to shard collections, see Shard a Collection.

If you need to add additional shards to support greater capacity, click on the wrench menu for the sharded cluster to create additional shards.

Note

Effects on Backup after Converting

The converted shard (original replica set) has:

  • Backup enabled

  • Previous snapshots retained

  • Ability to restore snapshots to this shard only

After converting, you should enable Backup for the entire sharded cluster. On databases running MongoDB FCV 4.0 or earlier, activating Backup causes Cloud Manager to start an initial sync on the config servers and the converted shard. Restores to the entire sharded cluster should use snapshots taken after conversion only.

←  Convert a Standalone to a Replica SetMigrate a Replica Set Member to a New Server →