Navigation
You were redirected from a different version of the documentation. Click here to go back.

Migrate a Replica Set Member to a New Server

Overview

You can replace one member of a managed replica set with another member from the Cloud Manager console. Use this process to migrate members of replica sets to new underlying servers. This procedure requires that you:

  1. Provision the new server.
  2. Add an extra member to the replica set.
  3. Shut down old member of the replica set.
  4. Un-manage the old member (Optional).

Considerations

Initial Sync

When you add a new replica set member, the member must perform an initial sync, which takes time to complete, depending on the size of your data set. For more information on initial sync, see Replica Set Data Synchronization.

Migrating Multiple Members

You can remove or migrate multiple replica set members at once, but a majority of the voting members must remain. If you need to remove more voting members, remove them one at a time.

Example

Example 1

You have a four-node replica set. All nodes are voting members. You can remove only one node, which preserves the majority of three out of four voting nodes. You can remove another node from the remaining three-node replica set afterward. This preserves the majority of the remaining voting nodes.

Example

Example 2

You have a four-node replica set. Three nodes are voting members and one node is a non-voting member. You can remove one voting member and one non-voting member at the same time. This preserves the majority of two out of three voting nodes.

To learn more about voting, see Replica Set High Availability and Replica Set Elections.

Removing members during migration might affect the ability of the replica set to acknowledge writes, depending on the level of write concern you use. For more information, see Write Concern in the MongoDB manual.

Procedure

Perform this procedure separately for each member of a replica set to migrate.

1

Provision the new server.

See Provision Servers.

2
3

Click Modify for the replica set cluster.

4

Add a member to the replica set.

In the Member Configuration section, click Add a Mongod to add a new mongod member.

Cloud Manager displays the following configuration settings for the mongod:

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.

This hostname can be a hostname, an FQDN, an IPv4 address, or an IPv6 address.

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

Ensure you select the Hostname that corresponds to the newly provisioned server.

5

Configure the new mongod process.

From the Replica Set Configuration section, view the table under the Replica Set Settings heading. The Process Name column lists the hostname and port of each replica set member set. Cloud Manager initially groups the processes under the replica set name. Click the caret right icon icon to the left of the replica set name to list all members associated to the replica set.

Configure the following settings for the Process Name that corresponds to the newly added member:

Setting Description
Version Select the MongoDB server version of the mongod process.
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 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 log file, including the log file name and extension. This setting corresponds to the systemLog.path configuration file option. The mongod must have permission to read and write to the specified file.

Example

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

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

6

Click Apply.

7

Click Review & Deploy to review your changes.

8

Click Confirm & Deploy to deploy your changes.

Otherwise, click Cancel and you can make additional changes.

9

Verify that the new member has synchronized.

On the Deployment page, click the name of the replica set to open the cluster view. Verify that the status for each new member is no longer in the Recovering state.

10

Remove the old member from the replica set.

  1. From the Deployment view, click Modify.
  2. Navigate to the Member Configuration section.
  3. Click the ellipsis h icon ellipses button for the member you want to remove.
  4. From the menu, select Remove from Replica Set.

Important

Removing the primary replica set member triggers an election. The replica set cannot process write operations until the election completes. For complete documentation on replica set elections, see Replica Set Elections.

Click Save to return to the Deployment screen.

Click Review Changes and then click Confirm & Deploy. Cloud Manager converts the removed replica set member to a standalone cluster visible in the Deployment view.

11

Optional: Shut down the old member.

From the Deployment view, click the standalone’s ellipsis icon and select Shutdown. Click Review Changes and then click Confirm & Deploy.

12

Optional: Remove the old member.

To remove the member from Cloud Manager management, click the ellipses icon and select Remove from Cloud Manager.

Cloud Manager does not automatically shut down a process removed from management. If you did not shut down the process in the previous step, you must do so manually by connecting directly to the host machine.

For complete documentation on removing processes from Cloud Manager management, see Stop Managing and/or Monitoring One Deployment.