postgresqlpgbouncer

WARNING server login failed: FATAL Peer authentication failed for user


I am using PgBouncer. Main concept is to authenticate connections only at PgBouncer side and trust between PgBouncer <-> PostgreSQL connections. My pg_hba.conf:

local all all trust

My pgbouncer.ini:

 [databases]
 someuser = dbname=someuser port=5432 auth_user=someuser

 [pgbouncer]
 listen_port = 6432
 listen_addr = *
 auth_type = md5
 auth_file = userlist.txt
 logfile = pgbouncer.log
 pidfile = pgbouncer.pid
 admin_users = postgres
 min_pool_size = 20
 reserve_pool_size = 5
 reserve_pool_timeout = 10.0
 ignore_startup_parameters = extra_float_digits
 unix_socket_dir = /var/run/postgresql

If I try to authenticate from localhost, then I don't get any errors, but if I try from another host, I get an error and lines in the pgbouncer.log:

[784564] WARNING server login failed: FATAL Peer authentication failed for user

Solution

  • Just added host=localhost to [databases] and this error disappeared. So, seems like if you are not add host to database configuration then pgbouncer try to connect to postgresql via socket and it raises Peer auth error