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

Viewed 3938

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.

1 Answers

After doing research Temporary failure in name resolution is a common issue for incorrect config in DNS, and fix it by looking at /etc/resolv.conf.

Related