Question

PostgreSQL: could not translate host name: <address> to address: Temporary failure in name resolution

Posted May 10, 2020 10.5k views
DigitalOcean Managed PostgreSQL Database

I am trying to migrate postgre db from DO VM into DO’s PostgreSQL managed database.

I used pg_dump for specific database, and use pg_restore to load the data.

All went well, except until I turn off the old VM, querying the data from new managed database lead to

could not translate host name: <address> to address: Temporary failure in name resolution

Whereas if querying from the VM that I’ve turned off, lead to expected result,

could not connect to server: Connection timed out

Confusingly, if I turn back on the VM, the managed database works without any issue.

I’m using command below to dump database,

pg_dump -h <> -U <> -p <> -Fc <> > <>.bak

And to restore,

psql -d  <connection-string> -f <>.bak

Is it a firewall issue, or have I misunderstood something about DO’s managed database?

I read https://www.digitalocean.com/docs/databases/postgresql/resources/troubleshoot-connections/#could-not-translate-hostname-to-address, the hostname is no issue since I can pull data if the VM is on.

I’m using PostgreSQL 10.12 on VM, 11 on Managed, and Ubuntu 16.04

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Turns out common DNS config issue, by looking at /etc/resolv.conf

Submit an Answer