MongoDB Documentation, Release 3.0.4 Step 5: Add the remaining members to the replica set. Add the remaining members with the rs.add() method. The following example adds two members: rs.add("mongodb1.example.net") rs.add("mongodb2.example.net") When complete, you have a fully functional replica set. The new replica set will elect a primary . Step 7: Check the status of the replica set. Use the rs.status() operation: rs.status() Step 6: Configure the outside member as priority 0 members . Configure the member located in Site B (in this example, mongodb2.example.net ) as a priority 0 member (page 567). rs.conf() For example, to set priority for the third member in the array (i.e., the member at position 2), issue the following sequence of commands: Note: The rs.reconfig() shell method can force the current primary to step down, causing an election. When the primary steps down, all clients will disconnect. This is the intended behavior. While most elec- tions complete within a minute, always make sure any replica configuration changes occur during scheduled maintenance periods. 1. View the replica set configuration to determine the members array position for the member. Keep in mind the array position is not the same as the _id : 2. Copy the replica set configuration object to a variable (to cfg in the example below). Then, in the variable, set the correct priority for the member. Then pass the variable to rs.reconfig() to update the replica set configuration. cfg = rs.conf() cfg.members[2].priority = 0 rs.reconfig(cfg) After these commands return, you have a geographically redundant three-member replica set. Deploy a Geographically Redundant Four-Member Replica Set A geographically redundant four-member de- ployment has two additional considerations: In most cases, the first architecture is preferable because it is the least complex. To deploy a geographically redundant four-member set: • One host (e.g. mongodb4.example.net ) must be an arbiter . This host can run on a system that is also used for an application server or on the same machine as another MongoDB process. • You must decide how to distribute your systems. There are three possible architectures for the four-member replica set: – Three members in Site A, one priority 0 member (page 567) in Site B, and an arbiter in Site A. – Two members in Site A, two priority 0 members (page 567) in Site B, and an arbiter in Site A. – Two members in Site A, one priority 0 member in Site B, one priority 0 member in Site C, and an arbiter in site A. 611 9.3. Replica Set Tutorials