PostgreSQL Follower Clusters - Scheduled Sync

Easily import data on a nightly basis from an existing PostgreSQL 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 on to 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 PostgreSQL version.
  • Either both clusters must have pgBouncer enabled OR neither cluster must have pgBouncer enabled.

📘

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 daily sync time.

  • Either both clusters must have SSL-enabled OR neither cluster must have SSL-enabled.
  • Disk Encryption must be disabled on both clusters OR enabled on both clusters.
  • Both clusters must be backed by the same cloud type (e.g. both are on AWS, both are on Azure, etc.).
  • Both clusters must be backed by the same deployment type (i.e. you can not create a daily sync 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

  1. Log into the ScaleGrid console.

  2. Go to your PostgreSQL page, and click the cluster you wish to import into.

  3. Under the Overview tab, click ‘Import Data’.

  4. In the expanded menu, select ‘Setup as Follower’.

  5. This will open the setup wizard:

693
  1. Select the source cluster from the drop-down, and select the time (in UTC) at which the sync job should be ran every day.

  2. Click Schedule and the relationship will be set up!

📘

Syncing Data From Source

Creating a daily sync 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 PostgreSQL Source Cluster

Once you have setup 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.

  1. Log into the ScaleGrid console.

  2. Go to your PostgreSQL page, and click the cluster you wish to import into.

  3. Under the Overview tab, click ‘Import Data’.

  4. 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.

745

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 Daily Sync option to break the relationship between the two clusters, and then setup a relationship with the new source.

  1. Log into the ScaleGrid console.

  2. Go to your PostgreSQL page, and click the cluster you wish to import into.

  3. Under the Overview tab, you will see an option to ‘Edit the Import Schedule’:

691
  1. Click on it to open the edit schedule wizard. Make your updates to the Start Time and confirm the changes:
671
  1. You can view the import schedule to confirm the changes have taken effect.

Stop Daily Sync

If you would like to stop the regular imports, you can do this by -

  1. Log into the ScaleGrid console.

  2. Go to your PostgreSQL page, and click the cluster you wish to import into.

  3. Under the Overview tab, click ‘Import Data’.

  4. 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.

647