Navigation

Convert a Replica Set to a Sharded Cluster

On this page

Overview

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

Procedure

1

Click Deployment, then the Processes tab, then the Topology view.

2

Click the ellipsis for the Replica Set.

From the menu, select Convert to Sharded Cluster.

3

Provide Details for your New Sharded Cluster.

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

Field Action
Cluster Name Specify the name of your new cluster. You cannot change this value after this step.
CSRS Name Specify the name of the Config Server Replica Set. Only required if the replica set deployment runs MongoDB 3.2 or later. You cannot change this value after this step.
Config Servers

Specify the Host Name and Port of each configuration server mongod process. You can configure the database path and logfile path in the next step.

Cloud Manager fixes each mongod data path to /data and log file path to /data/mongodb.log. Each configuration server mongod must have exclusive use of these paths on its specified host. The Cloud Manager Automation Agent must have file system permission to read, write, and execute all files and folders in these directories.

Click Add a Config Server to add a new configuration server. Click the trash alt icon button to remove a config server. You must deploy at least one configuration server.

MongoS

Specify the Host Name and Port of each mongos process. You can configure the logfile path in the next step.

Cloud Manager fixes the mongos log file path to /data/mongodb.log. The mongos must have exclusive use of this path on the specified host. The Cloud Manager Automation Agent must have file system permission to read, write, and execute all files and folders in these directories.

Click Add a MongoS to add a new configuration server. Click the trash alt icon button to remove a mongos. You must deploy at least one mongos.

4

Click Convert.

5

Configure Cluster-Wide Settings.

The Cluster Configuration section contains the following cluster-wide configuration settings. Settings marked with an * asterisk in the Cloud Manager UI are required.

Setting Description
Shard Name Prefix Specify the prefix of each shard in the cluster. Cloud Manager names each shard in the cluster using the <prefix_n> format, where n is a 0-indexed, monotonically increasing integer.
Process Name

Hostname and port of a mongod or mongos associated to the sharded cluster.

Cloud Manager groups mongod processes under their parent replica set name, and mongos processes under mongoses. Cloud Manager then groups all the cluster components under the cluster name. Click the caret right icon to the left of a grouping to list its sub-groups or processes. Modifying any of the available settings for a grouping changes the corresponding value in its sub-groups and processes.

Note

For clusters running MongoDB 3.0 or earlier, Cloud Manager groups the config server mongod processes under configServers.

Version

Select the MongoDB server version of the mongod or mongos process.

If the dropdown menu does not include the MongoDB version you want for your deployment, you must enable it in the Version Manager.

Data Directory

Specify the directory where the mongod process stores data files. This setting corresponds to the storage.dbPath mongod configuration file option. The Cloud Manager Automation Agent must have file system permission to read, write, and execute all files and folders in the specified directory.

Each mongod process must have its own database directory. If deploying multiple mongod processes on the same host, ensure each process has its own distinct directory.

Log File

Specify the full path to the mongod or mongos log file, including the log file name and extension. This setting corresponds to the systemLog.path configuration file option. The mongod or mongos must have permission to read and write to the specified file.

Example

Specifying /var/log/mongodb/mongo.log directs the mongod or mongos to store its logfile to /var/log/mongodb/ as mongo.log.

The mongod or mongos have its own unique log file. If deploying multiple mongod or mongos processes to the same host, ensure each mongod or mongos has its own distinct logfile.

6

Configure Each Shard in Your Cluster.

From the Member Configuration section, click Shard Settings to open the shard configuration options. Cloud Manager lists each shard in the cluster and the mongod processes associated to that shard. Each shard process has the the following options. You cannot modify options that are greyed out:

Setting Description
Member

Select one of the following replica set member roles from the menu:

  • Default

    A data-bearing member of the replica set that can become the primary and vote in elections.

  • Arbiter

    A non-data bearing member of the replica set that can vote in elections. Corresponds to the arbiterOnly replica configuration option.

  • Hidden

    A data-bearing member of the replica set that can vote in elections. Corresponds to the hidden replica configuration option.

  • Delayed Hidden

    A data-bearing member of the replica set that can vote in elections. Corresponds to the slaveDelay and hidden replica configuration options.

Hostname Select from the menu the host to which Cloud Manager Automation deploys the replica set member. The menu only lists hosts under Cloud Manager Automation. For complete documentation on adding servers to Cloud Manager Automation, see Provision Servers for Automation.
Port

Specify the IANA port number for the mongod process. This setting corresponds to the net.port configuration file option. Defaults to 27017.

The mongod must have exclusive access to the specified port. If deploying multiple mongod processes to a single host, you must select a unique unused port for each process.

Votes Specify the number of votes that the replica set member has during elections. This setting corresponds to the votes mongod replica set configuration option.
Priority Specify the priority of the member during elections. Replica set members with a priority of 0 cannot become the primary and cannot trigger elections. This setting corresponds to the priority mongod replica set configuration option.
Delay Specify the number of seconds “behind” the primary member this member should “lag”. This setting corresponds to the slaveDelay mongod replica set configuration option.
Build Indexes Specify true to direct the mongod to build indexes. This setting corresponds to the buildIndexes mongod replica set configuration option.
Tags

Specify the tag or tags associated to the replica set. This setting corresponds to the tags mongod replica set configuration option.

For complete documentation on replica set tags, see Replica Set Tags

Add a Mongod

Adds an additional mongod process as a replica set member.

Adding a new mongod process also updates the list of processes in the Replica Set Configuration section. You must configure the Version, Data Directory, and Log File of the new process.

7

Configure Each Configuration Server in Your Cluster.

Cloud Manager displays a different heading for your configuration server settings depending on the MongoDB version you selected for your configuration servers.

MongoDB 3.2 or Later:

From the Member Configuration section, click Config Server Replica Set Settings to open the CSRS configuration options. Each config server replica set member has the following options:

Setting Description
Member

Select one of the following replica set member roles from the menu:

  • Default

    A data-bearing member of the replica set that can become the primary and vote in elections.

  • Arbiter

    A non-data bearing member of the replica set that can vote in elections. Corresponds to the arbiterOnly replica configuration option.

  • Hidden

    A data-bearing member of the replica set that can vote in elections. Corresponds to the hidden replica configuration option.

  • Delayed Hidden

    A data-bearing member of the replica set that can vote in elections. Corresponds to the slaveDelay and hidden replica configuration options.

Hostname Select from the menu the host to which Cloud Manager Automation deploys the replica set member. The menu only lists hosts under Cloud Manager Automation. For complete documentation on adding servers to Cloud Manager Automation, see Provision Servers for Automation.
Port

Specify the IANA port number for the mongod process. This setting corresponds to the net.port configuration file option. Defaults to 27017.

The mongod must have exclusive access to the specified port. If deploying multiple mongod processes to a single host, you must select a unique unused port for each process.

Votes Specify the number of votes that the replica set member has during elections. This setting corresponds to the votes mongod replica set configuration option.
Priority Specify the priority of the member during elections. Replica set members with a priority of 0 cannot become the primary and cannot trigger elections. This setting corresponds to the priority mongod replica set configuration option.
Delay Specify the number of seconds “behind” the primary member this member should “lag”. This setting corresponds to the slaveDelay mongod replica set configuration option.
Build Indexes Specify true to direct the mongod to build indexes. This setting corresponds to the buildIndexes mongod replica set configuration option.
Tags

Specify the tag or tags associated to the replica set. This setting corresponds to the tags mongod replica set configuration option.

For complete documentation on replica set tags, see Replica Set Tags

Add a Mongod

Adds an additional mongod process as a replica set member.

Adding a new mongod process also updates the list of processes in the Cluster Configuration section. You must configure the Version, Data Directory, and Log File of the new process.

MongoDB 3.0 or Earlier

From the Member Configuration section, click Config Server Settings to open the configuration server options. Each configuration server has the following options:

Setting Description
Hostname Select from the menu the host to which Cloud Manager Automation deploys the replica set member. The menu only lists hosts under Cloud Manager Automation. For complete documentation on adding servers to Cloud Manager Automation, see Provision Servers for Automation.
Port

Specify the IANA port number for the mongod process. This setting corresponds to the net.port configuration file option. Defaults to 27017.

The mongod must have exclusive access to the specified port. If deploying multiple mongod processes to a single host, you must select a unique unused port for each process.

8

Configure Each mongos in Your Cluster.

From the Member Configuration section, click Mongos Settings to open the mongos configuration options. Each mongos process has the following options. You cannot modify options that are greyed out:

Setting Description
Hostname Select from the menu the host to which Cloud Manager Automation deploys the mongos. The menu only lists hosts under Cloud Manager Automation. For complete documentation on adding servers to Cloud Manager Automation, see Provision Servers for Automation.
Port

Specify the IANA port number for the mongos process. This setting corresponds to the net.port configuration file option. Defaults to 27017.

The mongos must have exclusive access to the specified port. If deploying multiple mongos processes to a single host, you must select a unique unused port for each process.

Add a Mongos Click to add an additional mongos process.
9

Configure Each Replica Set in Your Cluster.

The Replication Settings section contains the following configuration options for each replica set in the cluster:

Setting Description
Protocol Version

Select the replication protocol version used by the replica set. This setting corresponds to the protocolVersion replica set configuration option.

For more information, see Replica Set Protocol Versions.

Chaining Allowed Specify true to allow secondary members to replicate from other secondary members. This setting corresponds to the chainingAllowed replica set configuration option.
Write Concern Majority Journal Default Determines the behavior of {w:"majority"} write concern if the write concern does not explicitly specify the journal option j. This setting corresponds to the writeConcernMajorityJournalDefault replica set configuration option.
Heartbeat Timeout (secs) Specify the number of seconds that the replica set members wait for a successful heartbeat from each other. This setting corresponds to the heartbeatTimeoutSecs replica set configuration option.
Election Timeout (ms) Specify the time limit in milliseconds for detecting when a replica set’s primary is unreachable. This setting corresponds to the electionTimeoutMillis replica set configuration option.
CatchUp Timeout (ms) Specify the time limit in milliseconds for a newly elected primary to sync, or catch up, with the other replica set members that may have more recent writes. This setting corresponds to the catchUpTimeoutMillis replica set configuration option.
CatchUp Takeover Delay (ms) Specify the time in milliseconds a node waits to initiate a catchup takeover after determining it is ahead of the current primary. This setting corresponds to the catchUpTakeoverDelayMillis replica set configuration option.
10

Configure your Cloud Manager Managed Indexes.

The Index Configuration section allows you to create, change, or remove Cloud Manager managed indexes on your MongoDB deployment. For complete documentation on Cloud Manager managed indexes, see Manage Indexes.

Setting Description
Add Adds an index for Cloud Manager to manage. Select an index type to open the index creation walkthrough.
Unmanage Removes the index from Cloud Manager management. Only visible if you have at least one Cloud Manager managed index. Removing an index from Cloud Manager management does not delete the index.
11

Set any Advanced Configuration Options for your MongoDB sharded cluster.

The Advanced Options section allows you to set MongoDB runtime options for each MongoDB process in your deployment.

To add an option:

  1. Click Add Option.
  2. From the Select a Process Type menu, click the process for which you want to add an option.
  3. Click Select a Startup Option and select the configuration option.
  4. Cloud Manager displays a context-sensitive input for configuring an acceptable value for the selected option.
  5. Click Add to add the selected option and its corresponding value to every process of the selected process type in the cluster.

Cloud Manager lists each process in the cluster grouped logically. Click the grey arrow to the left of the logical grouping to display its sub-groupings and processes. You can modify the advanced options for each process individually as necessary.

For descriptions of the available Advanced Options, see Advanced Options for MongoDB Deployments.

12

Click Save.

13

Click Review & Deploy to review your changes.

14

Click Confirm & Deploy to deploy your changes.

Otherwise, click Cancel and you can make additional changes.

15

Modify your Application to Connect to the mongos Processes Instead of the Replica Set.

From the Cloud Manager UI, click the ellipsis h icon 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

After you convert a replica set to a sharded cluster, you can enable sharding for a database and shard collections. See Shard a Collection for instructions on how to shard collections.

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