MongoDB® Follower Clusters - Scheduled Sync
Easily import data on a nightly basis from an existing MongoDB® cluster hosted on ScaleGrid into another cluster in your account by setting up a "follower cluster". This is very useful when you have a dev/test setup that you wish to sync with the production server on a regular schedule.
Once you create a follower relationship, every day at the time you have chosen, the latest backup from the source cluster (the cluster to import from) will be restored onto the destination cluster (the cluster to import into).
Ensure Imported Data Is Current
The sync job will not automatically create a backup on the source cluster. Backup schedule must be set up on the source cluster to ensure the latest backup is available before the sync job is triggered.
Refer to our scheduled backup document to learn how to schedule regular backups on the source cluster.
Prerequisites
You can set up a follower relationship between two clusters only if the following criteria are met:
- Both clusters must have the exact same MongoDB® version.
- Both clusters must have the same MongoDB® Engine.
For the best results, the source cluster (the one to import from) must also have daily backups scheduled that start at least an hour before the sync time.
- Both clusters must either be SSL-enabled, or neither cluster must be SSL-enabled.
- Disk Encryption must be enabled or disabled on both clusters.
- Both clusters must be backed by the same cloud type (e.g., both are on AWS, both are on Azure, both are on GCP, etc.).
- Both clusters must be backed by the same deployment type (i.e., you can not create a follower relationship between a Dedicated Instance and a BYOC Instance).
If you have clusters backed by more than one AWS/OCI account/Azure tenant/GCP project, both source and destination cluster must be under the same account/tenant/project.
- Both clusters must be located in the same region (unless you are hosting through AWS or GCP).
Cross-datacenter clusters are currently not supported in this workflow.
Create a Follower Relationship
-
Log into the ScaleGrid console.
-
Go to your MongoDB® page and select the cluster you wish to import®.
-
Under the Overview tab, click ‘Import Data’.
-
In the expanded menu, select ‘Setup as Follower’.
-
This will open the setup wizard:
-
Select the source cluster from the drop-down, and select the time (in UTC) at which the sync job should be ran every day.
-
Click Schedule and the relationship will be set up!
Syncing Data From Source
Creating a follower relationship does not trigger an immediate data syncing. For example, if the current time is 10:00 UTC and you have selected the start time as 02:00 UTC, data will be restored on to the destination cluster only at 02:00 UTC the next day. To trigger an immediate sync, use the Sync Now feature after creating the relationship.
On-Demand Sync from MongoDB® Source Cluster
Once you have set up the follower relationship, you can sync from source on-demand.
Syncing overwrites all the data on the destination (the cluster being synced). If you would like to preserve this information, please trigger a backup before you sync.
-
Log into the ScaleGrid console.
-
Go to your MongoDB® page, and click the cluster you wish to import into.
-
Under the Overview tab, click ‘Import Data’.
-
In the expanded menu, select ‘Sync Now’. A confirmation dialog box will pop up - confirm you wish to Sync, and wait for the Sync Job to complete.
Edit the Import Schedule
If you wish to change the time at which imports are triggered, you can follow these steps:
You can not change the source cluster through this method. If you wish to change the source cluster, use the Stop Following option to break the relationship between the two clusters, and then setup a follower relationship with the new source.
-
Log into the ScaleGrid console.
-
Go to your MongoDB® page, and click the cluster you wish to import into.
-
Under the Overview tab, you will see an option to ‘Edit the Import Schedule’:
- Click on it to open the edit schedule wizard. Make your updates to the Start Time and confirm the changes:
- You can view the import schedule to confirm the changes have taken effect.
Stop Following
If you would like to stop the regular imports, you can break the follower relationship by:
-
Log into the ScaleGrid console.
-
Go to your MongoDB® page, and click the cluster you wish to import into.
-
Under the Overview tab, click ‘Import Data.’
-
In the expanded menu, select ‘Stop Following’. A confirmation dialog box will pop up - confirm you wish to stop following, and the relationship will be broken.
Updated 3 months ago