We receive the error below when executing the command
"pg_autoctl show uri --pgdata <data_dir>" on monitor server:
20:30:39 40100 WARN Failed to connect to "postgres://autoctl_node@<wrong_monitor_host_name>:5432/pg_auto_failover?sslmode=require", retrying until the server is ready
20:30:41 40100 ERROR Connection to database failed: could not translate host name "<wrong_host_name>" to address: Name or service not known
Meanwhile, the hostname is set correctly in both
/etc/hostname and
/etc/hosts.
The cause of the issue could be due to the fact that we set the wrong monitor host name when adding worker nodes or we changed monitor hostname after the
pg_autofailover environment was configured.