Doug Whitfield

Doug Whitfield at

#postgres folks, any out-of-the-box thoughts about this error:

psql: error: could not connect to server: could not connect to server: Connection refused
Is the server running on host "" and accepting
TCP/IP connections on port 9999?

Obviously, the firewall has been checked.

I don't remember having used postgres ever and I forget everything I ever knew about IT very fast but here go two (maybe silly) ideas: I assume you have checked postgres server logs for errors, so the one I can add is to check if socket file is locked by any other process.

I just remembered another test: Try to telnet/SSH to the IP:Port of postgres server and check if something helpful info comes out.

EVAnaRkISTO at 2021-02-09T12:12:35Z

different port in this case, but the issue is actually with pcp_recovery_node part of pgpool.

[postgres@521 ~]$ pcp_recovery_node -h -p 9898 -U pgpool -n 1
ERROR: connection to host "" failed with error "Connection refused"

[postgres@521 data]$ psql -d postgres -h -U pgpool -c "select count from public._test"
(1 row)

The pgpool docs for anyone curious:

Doug Whitfield at 2021-02-09T14:29:01Z

not SELinux on this one machine:

SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          permissive
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     actual (secure)
Max kernel policy version:      31

Doug Whitfield at 2021-02-09T16:14:00Z

I can only think of this "Solving computer problems 101" solution:

It won't solve your problem but it will make you laugh. ;-)

EVAnaRkISTO@DM at 2021-02-10T11:07:54Z