1

We are migrating from Google-Cloud PGSQL managed database to a managed PGSQL server on Digital ocean.

The dilemma we are facing is that both Google and Digital ocean are managed so we have no access to directories so we can't dump then restore. So how would we go about this? Is there a command that copies the data directly from Google-Cloud PGSQL to Digital ocean?

Digital oceans resources assume we have access to a directory.

3
  • You can use pg_dump and pg_restore, no need to have access to directories of managed services. Do install PostgreSQL binaries in any VM's like local machine or EC2, Droplets and from there do as digitalocean.com/docs/databases/postgresql/how-to/…
    – Rj_N
    Jul 8, 2020 at 18:23
  • I was really hoping there was a more efficient way then spinning a new VPS.
    – sqwale
    Jul 8, 2020 at 19:30
  • You can create pipe for bump and restore, and to optimize this, you can use -Fc and -j #. and this is an efficient way to do migrate for managed services since we don't have access to the directory. nor pg_dumpall.
    – Rj_N
    Jul 8, 2020 at 19:54

1 Answer 1

0

Install pg_dump and pg_restore or install entire PostgreSQL Binaries on your local machine or EC2, Droplet compute.

Create a dump file using pg_dump that contains the data to be loaded from GCP PG:

pg_dump -Fc -v --host=<IP or hostname> --username=<dbadmin> --dbname=<DB name> -f  dbname.dump

Restore the data into the target Database for PostgreSQL using pg_restore :

After you've created the target database, you can use the pg_restore command and the -d, --dbname parameter to restore the data into the target database from the dump file.

pg_restore -v --no-owner --host==<IP or hostname> --port=<port> --username=< dbadmin > --dbname=<target database name> dbname.dump

--no-owner parameter causes all objects created during the restore to be owned by the user specified with --username. For more information , click on pg_restore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.