Navigation

Migrate a Replica Set Member to a New Server

Overview

For Ops Manager managed replica sets, you can replace one member of a replica set with another new member from the Ops Manager console. Use this process to migrate members of replica sets to new underlying servers. From a high level, this procedure requires that you add a member to the replica set on the new server and then shut down the existing member on the old server. Specifically, you will

  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

When migrating multiple members, you must keep a majority of voting members active with respect to the original number of voting members. Otherwise your primary will step down and your replica set become read-only. You can remove multiple members at once only if doing so leaves a majority. For more information on voting, see Replica Set High Availability and Replica Set Elections in the MongoDB Manual.

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

Click Deployment, then the Processes tab.

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.

Ops 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 Ops Manager Automation deploys the replica set member. The menu only lists hosts under Ops Manager Automation. For complete documentation on adding servers to Ops 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

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

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

11

Optional: Remove the old member.

To remove the member from Ops Manager management, click the ellipsis h icon ellipsis icon and select Remove from Ops Manager.

Ops 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 Ops Manager management, see Disable Automation for a Deployment.