Report this

What is the reason for this report?

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

Posted on May 10, 2020

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



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!

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.

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.