Bobcares

How to Migrate PostgreSQL Databases to DigitalOcean Using Continuous Migration

PDF Header PDF Footer

Learn how to migrate PostgreSQL databases to DigitalOcean using continuous migration for zero downtime and seamless data replication. Our PostgreSQL support team is always here to help you.

How to Migrate PostgreSQL Databases to DigitalOcean Using Continuous Migration

Migrate PostgreSQL Databases to DigitalOceanLooking to migrate PostgreSQL databases to DigitalOcean without downtime? DigitalOcean’s Continuous Migration method allows you to replicate data from your existing PostgreSQL database to a DigitalOcean Managed Database cluster while keeping the source live and accessible. This guide walks you through the full process, step-by-step, with no skipped commands or vague explanations.

What is Continuous Migration?

Continuous migration establishes a connection to your source database and uses logical replication to mirror your data to the target cluster. It keeps replicating changes until you manually stop it or until there’s no new data left.

Note: You cannot use this to move a cluster between DigitalOcean Teams.

Step 1: Get Source Database’s Credentials

Gather the following from your source database:

  • Hostname/connection string
  • Port (Default for DigitalOcean is 25061)
  • Username (Must have superuser privileges)
  • Password

Refer to your provider’s documentation to find this info.

Step 2: Check PostgreSQL Version Compatibility

Ensure the source version is not newer than the target DigitalOcean cluster version. If needed, upgrade the target cluster first.

Step 3: Prepare the Source Database

Allow Remote Connections

Check if your database is listening to all IPs:

SHOW listen_addresses;

Expected result:

listen_addresses
----------------
*
(1 row)

If not, enable it:

ALTER SYSTEM SET listen_addresses = '*';

Then update the pg_hba.conf file:

SHOW hba_file;

Open the file:

nano pg_hba.conf

Replace the IPv4 line with:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
host    all             all             0.0.0.0/0               md5
host    all             all             ::/0                    md5

Enable Logical Replication

Check current replication level:

SHOW wal_level;

Expected output:

wal_level
-----------
logical
(1 row)

If not set to logical, run:

ALTER SYSTEM SET wal_level = logical;

Set Maximum Replication Slots

Verify current setting:

SHOW max_replication_slots;

If the number is less than the number of databases you’re migrating, set it higher:

ALTER SYSTEM SET max_replication_slots = <number_of_databases>;

Replace <number_of_databases> with the actual count.

Restart PostgreSQL Server

To apply all changes:

sudo service postgresql stop
sudo service postgresql start

Step 4: Initiate the Migration (via Control Panel)

  1. Go to the DigitalOcean Control Panel.
  2. Click Databases and select the target database you’ve set up (such as one linked from a GoDaddy domain to a DigitalOcean Droplet).
  3. From the Overview page, click Actions > Set Up Migration.
  4. Enter the source database credentials and click Start Migration. If you encounter connection issues, see DigitalOcean all authentication methods failed.

You’ll see a migration status banner at the top of the page. You can click Stop Migration anytime to end the process. Migrated data remains intact even if you stop the sync.

Important Notes During Migration

  • Do not write to tables being edited by the migration.
  • Avoid changing the source database’s wal_level or max_replication_slots.
  • Don’t modify firewall rules or listen_addresses once the migration starts, especially during a DigitalOcean kernel upgrade.
  • Migrations automatically stop after 2 weeks.

[If needed, Our team is available 24/7 for additional assistance.]

Conclusion

To keep clusters in sync longer-term, don’t rely on continuous migration. Instead, set up a read-only node.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US
server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!