Docs Menu
Docs Home
/
MongoDB Cloud Manager
/

Convert a Replica Set to a Sharded Cluster

On this page

  • In MongoDB Cloud Manager, go to the Deployment page for your project.
  • Go to the Processes page.
  • Select 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's not already displayed, select your desired project from the Projects menu in the navigation bar.

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

    The Deployment page displays.

2

Click the Processes tab for your deployment.

The Processes page displays.

3
4

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

5

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
    Type the name of the CSRS.

    Note

    You cannot change these values after you click Convert.

  2. Set the following values for each 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 mongod.

    The example path is /data.

    The 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 mongod.

    The example path is /data/mongodb.log.

    The 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.

6
7

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

8

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.

Back

Covert Standalone to Replica Set