Docs Menu

Docs HomeMongoDB Ops Manager

Migrate a Replica Set Member to a New Server

On this page

  • Overview
  • Considerations
  • Procedure

You can replace one member of a managed replica set with another member from the Ops 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).

When you add a new replica set member, the member must perform an inital 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.

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.

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

1

See Provision Servers.

2
  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. Click Processes in the sidebar.

3
4

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

Ops Manager displays the following configuration settings for the ~bin.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 secondaryDelaySecs 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.

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

Port

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

The ~bin.mongod must have exclusive access to the specified port. If deploying multiple ~bin.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 ~bin.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 ~bin.mongod replica set configuration option.

Delay

Specify the number of seconds "behind" the primary member this member should "lag". This setting corresponds to the secondaryDelaySecs ~bin.mongod replica set configuration option.

Build Indexes

Specify true to direct the ~bin.mongod to build indexes. This setting corresponds to the buildIndexes ~bin.mongod replica set configuration option.

Tags

Specify the tag or tags associated to the replica set. This setting corresponds to the tags ~bin.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

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 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 ~bin.mongod process.

Note

Available Versions

Ops Manager lists only the MongoDB versions that are available for your deployment.

To disable this filtering, see automation.versions.download.baseUrl.allowOnlyAvailableBuilds.

Data Directory

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

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

Log File

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

Example

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

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

6
7
8

Otherwise, click Cancel and you can make additional changes.

9

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
  1. From the Deployment view, click Modify.

  2. Navigate to the Member Configuration section.

  3. Click the 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

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

12

To remove the member from Ops Manager management, click the 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 Stop Managing and/or Monitoring One Deployment.

←  Convert a Replica Set to a Sharded ClusterConvert Config Servers to a Replica Set →