I have a PgBouncer
installed on the same host with postgres server and I have several scenarios for it:
pgwatch2
) should connect with peer
authentication to the postgres
(for example) database via PgBouncer
PgBouncer
(with host
authentication method)I can't understand how to properly configure PgBouncer
to follow the rules:
PgBouncer
is done via socket, it should proceed with peer
authentication to the postgres serverhost
authentication method, PgBouncer
should also connect to postgres server with the corresponding host
methodMy current configuration is as follows, but it doesn't choose socket or localhost properly(sometimes it fails):
[databases]
* = host=localhost port=5432
* = host=/tmp port=5432
I added two different rules to fix my issues, but it doesn't seem to work as expected.
I think that you can't distinguish pools based on the incoming connection type. You could create a fake database entry, and then direct it to the real database in the config:
[databases]
monitoring_database = host=/tmp dbname=postgres port=5432
* = host=localhost port=5432
But in this case the peer authentication would be coming from the owner of the pgbouncer process, not from the owner of the monitoring client.