Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of MongoDB Ops Manager, refer to the upgrade documentation.
You were redirected from a different version of the documentation. Click here to go back.

Seed a New Secondary from Backup Restore

Overview

When a natural synchronization of a new secondary host costs too much time or resources, seeding a secondary from a backup restore is a faster better alternative. Seeding also does not hit a live mongo instance to retrieve data.

Prerequisites

To seed a secondary from a backup restore file, you must have:

  • A backup restore file.
  • The seedSecondary.sh file included in the backup restore file.

Considerations

The seedSecondary.sh file will not be in the backup restore if you have blacklisted dbs or collections or have resynced your backup after the snapshot (or for config servers). In these cases, including the script would cause an inconsistent secondary. In the case of a blacklist, your secondary would not include some collections which would cause problems for your deployment.

Seeding a new secondary from a backup restore requires an oplog window on the current primary that spans back to the snapshot’s timestamp.

Procedure

1

Remove the broken secondary from your replica set.

rs.remove("SECONDARYHOST:SECONDARYPORT")
2

Login to the server on which to create the new secondary.

3

Bring up new node as a standalone.

tar -xvf backup-restore-name.tar.gz
mv backup-restore-name data
mongod --port <alternate-port> --dbpath /data

Where ALTERNATEPORT is not the usual port your secondary runs on.

4

Run seedSecondary.sh script to create oplog collection and seed with correct timestamp.

5

Shut down the new secondary on the alternate port.

6

Start up the new secondary.

mongod --port <secondary-port> --dbpath /data  --replSet REPLICASETNAME
7

Add the new secondary to the replica set on the primary host.

rs.add("<secondary-host>:<secondary-port>")