## Add Members to a Replica Set 

## Overview 

This tutorial explains how to add an additional member to an existing replica set . For background on replication deployment patterns, see the Replica Set Deployment Architectures (page 572) document. 

Maximum Voting Members A replica set can have a maximum of seven voting members (page 580). To add a member to a replica set that already has seven votes, you must either add the member as a non-voting member (page 583) or remove a vote from an existing member . 

Control Scripts In production deployments you can configure a control script to manage member processes. 

Existing Members You can use these procedures to add new members to an existing set. You can also use the same procedure to “re-add” a removed member. If the removed member’s data is still relatively recent, it can recover and catch up easily. 

Data Files If you have a backup or snapshot of an existing member, you can move the data files (e.g. the dbPath directory) to a new system and use them to quickly initiate a new member. The files must be: 

• A valid copy of the data files from a member of the same replica set. See Backup and Restore with Filesystem Snapshots (page 243) document for more information. 

Important: Always use filesystem snapshots to create a copy of a member of the existing replica set. Do not use mongodump and mongorestore to seed a new replica set member. 

• More recent than the oldest operation in the primary’s oplog . The new member must be able to become current by applying operations from the primary’s oplog. 

## Requirements 

1. An active replica set. 

2. A new MongoDB system capable of supporting your data set, accessible by the active replica set through the network. 

Otherwise, use the MongoDB installation tutorial (page 5) and the Deploy a Replica Set (page 603) tutorials. 

## Procedures 

Prepare the Data Directory Before adding a new member to an existing replica set , prepare the new member’s data directory using one of the following strategies: 

• Make sure the new member’s data directory does not contain data. The new member will copy the data from an existing member. 

If the new member is in a recovering state, it must exit and become a secondary before MongoDB can copy all data as part of the replication process. This process takes time but does not require administrator intervention. 

