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

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, 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

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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