pgbouncer bind(): Permission denied
-
01-01-2021 - |
Вопрос
I have pgbouncer running locally with config:
[databases]
* = host=myremoteIP port=5432 user=postgres
listen_addr = *
listen_port = 6432
When I connect using pgsql using:
psql -h 127.0.0.1 -p 6432 -U postgres -W
I receive an error:
psql: ERROR: pgbouncer cannot connect to server
/var/log/pgbouncer/pgbouncer.log contains the following:
WARNING Cannot listen on unix:/var/run/postgresql/.s.PGSQL.6432: bind(): Permission denied
Disabling the firewall on the local and remote machines still results in the same error.
What configuration am I missing?
Решение
The error message in the log was a red herring, and due to the configuration for Unix sockets (when I only needed TCP). Disabling Unix sockets by setting the unix_socket_dir
to an empty string (as per the documentation) made those errors disappear from the logs.
The connection problem was because I needed to specify the password in the pgbouncer.ini file.
The line:
* = host=myremoteIP port=5432 user=postgres
Needed to be:
* = host=myremoteIP port=5432 user=postgres password=mypassword
I can now connect using psql.