aiven-db-migrate tool is the recommended approach for migrating your PostgreSQL to Aiven. It supports both logical replication and also using a dump and restore process. Find out more about the tool on GitHub.
Logical replication is the default method and once successfully set up, this keeps the two databases synchronized until the replication is interrupted. If the preconditions for logical replication are not met for a database, the migration falls back to using
Regardless of the migration method used, the migration tool first performs a schema dump and migration to ensure schema compatibility.
Logical replication also works when migrating from AWS RDS PostgreSQL 10+. Google Cloud Platform’s PostgreSQL for CloudSQL does not support logical replication.
The following are the two basic requirements for a migration:
the source server is publicly available or there is a virtual private cloud (VPC) peering connection between the private networks
a user account with access to the destination cluster from an external IP, as configured in
pg_hba.confon the source cluster is present
Additionally to perform a logical replication, the following need to be valid:
PostgreSQL version 10 or newer
Credentials with superuser access to the source cluster or the
aiven-extrasextension installed (see also: Aiven Extras on GitHub)
aiven_extras extension allows you to perform publish/subscribe-style logical replication without a superuser account, and it is preinstalled on Aiven for PostgreSQL servers.
An available replication slot on the destination cluster for each database migrated from the source cluster.
wal_levelsetting on the source cluster to
aiven-db-migrate migration tool checks the following requirements before it starts the actual migration:
A connection can be established to both source and target servers
The source and target server are not the same
A connection can be established to all source databases, ignoring
template1, and admin databases
There is enough disk space on the target for 130% of the total size of the source databases (ignoring
template1, and admin databases)
There are at least as many free logical replication slots as there are databases to migrate
A connection can be established to any target database that already exists on both source and target servers
The target version is the same as or newer than the source version
All languages installed in the source are available in the target
All extensions in the source are installed or available in the target
Source extensions not installed in the target can be installed:
by connecting as a superuser
without requiring superuser access
by inclusion in the allowed extensions list
by being a trusted extension (for PostgreSQL 13 and newer)
In addition, for using the logical replication method:
The source version is PostgreSQL 10 or newer
wal_levelis set to
The user connecting to the source has superuser access or the
aiven_extraextension is or can be installed on each database
There’s a detailed guide for performing the migration: Migrate to Aiven for PostgreSQL with aiven-db-migrate