Migrate your self-managed Postgres database to the PG AI Hybrid Manager

To migrate a self-managed Postgres database to a database cluster created with the PG AI Hybrid Manager:

  1. Deploy the EDB DMS Reader
  2. Create a destination database cluster managed by the PG AI Hybrid Manager
  3. Prepare the Postgres source databases so the EDB DMS Reader can access data
  4. Configure the EDB DMS Reader
  5. Run the EDB DMS Reader
  6. Prepare the source schema and import it to the target database
  7. Create a migration

Deploy the EDB DMS Reader

Deploying the EDB DMS Reader on an a machine that has access to your database server allows the Reader to perform a connection between the Postgres database and the PG AI Hybrid Manager so it is recognized as a source for migration.

See Installing the Data Migration Service Reader for more information.

Create a destination database cluster managed by the PG AI Hybrid Manager

When you migrate a database to the PG AI Hybrid Manager, you need to create an EDB Postgres Advanced Server database cluster. You'll target this database later when performing the schema migration, as this cluster will serve as a migration destination.

For more information, see Creating a database cluster.

Prepare the Postgres source databases so the EDB DMS Reader can access data

See Preparing Postgres source databases for more information.

Configure the EDB DMS Reader

To configure the EDB DMS Reader so the PG AI Hybrid Manager has access to source database data, you need to fill in some values in the reader script that give it access to both the source and target databases for migration.

  1. Obtain credentials from the PG AI Hybrid Manager Console as explained in Getting credentials.

  2. Perform the steps in the Configuring the reader section, but ensure you set the following variables set in the reader script:

    export CLOUD_PROVIDER=appliance
    export RW_SERVICE_HOST=<transporter-rw-service-host>
    Note

    Set RW_SERVICE_HOST to the domain name or host associated with the PG AI Hybrid Manager ingress.

    Derive RW_SERVICE_HOST from the TRANSPORTER_RW_SERVICE_DOMAIN_NAME you assigned to your instance via the values.yaml file during installation and add /transporter.

    Alternatively, derive RW_SERVICE_HOST from the URL you use to access the PG AI Console. For example, if the URL is https://portal-transporter.foo.network, get the domain name, and add /transporter at the end.

    In this example, you'd have to set:

    export RW_SERVICE_HOST=transporter.foo.network/transporter

Run the EDB DMS Reader

Execute the EDB DMS Reader to start reading the source database. This doesn't perform a migration yet, only ensures the DMS has access and can read the source database.

Prepare the source schema and import it to the target database

This step is not dependent on the previous steps, so it can be performed at any time before creating a migration. You must ensure the schema is converted and migrated to the target database before you create a data migration.

There are many tools EDB offers to prepare the schema. For migrations from self-managed Postgres instances, we recommend using EDB Migration Toolkit (MTK). MTK's offline migration capability provides an easy way to extract a database's schema and separate constraints.

Note

Ensure you exclude foreign key, check, and exclusion constraints from the DDL before importing the schema to the target database. Review Schema integrity and performance considerations to learn more about why constraints must be disabled and to review other considerations.

Create a migration

In the PG AI Console:

  1. Create a migration.

  2. Verify that the migration was successful. You can perform spot checks of tables, rows, schemas, etc., with psql, or compare both databases with LiveCompare.

  3. If you selected a Snapshot + Replication migration, mark the migration as completed. Otherwise, skip this step.

  4. Re-apply any excluded constraints.


Could this page be better? Report a problem or suggest an addition!