By MisrTech SAE
tried to migrate a PostgreSQL database from a Docker container to a DigitalOcean Managed Database, but when I tested the connection to the source database, it failed to connect.
I followed the migration guide by preparing the source database for migration with the following steps:
However, it still fails to connect to the source database.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
Rather than using the live replication migration, have you considered using pg_dump
and then importing that dump to your managed database?
You can do that by following the steps here:
https://docs.digitalocean.com/products/databases/postgresql/how-to/import-databases/
To use pg_dump
, you need specify the connection details (like admin username and database) and redirect the output of the command to save the database dump. The command will look like this:
pg_dump -h <your_host> -U <your_username> -p 25060 -Fc <your_database> > <path/to/your_dump_file.pgsql>
Then once you have the dump, to import it to the new source database, ensure that you can connect to your target database with psql. Then, you need to find the connection URI for the target database you want to add the existing data into.
To import a source database in custom format, use the pg_restore
command:
pg_restore -d <your_connection_URI> --jobs 4 <path/to/your_dump_file.pgsql>
If you prefer the live migration, can you share the exact changes that you’ve made to your Docker Postgres instance? And also share the conf file here.
- Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.