cc young
cc young

Reputation: 20245

how to configure postgresql / pgbouncer using unix sockets?

cannot make simplest pgbouncer / postgresql combo work using default unix sockets.

logged in as foo, with an existent database (created by foo) bar. these work fine:

$ psql bar
$ psql -U foo bar
$ psql -U foo --password bar

in /etc/pgbouncer/userlist.txt:

"foo" "foo"

in /etc/pgbouncer/pgbouncer.ini:

[databases]
mydb =

[pgbouncer]
unix_socket_dir = /var/run/postgresql
auth_type = trust
auth_file = /etc/pgbouncer/userlist.txt

when I try to login with psql -p 6432 mydb or with psql -p 6432 mydb --password, after entering password, I get

psql: ERROR:  Peer authentication failed for user "foo"

Upvotes: 2

Views: 4537

Answers (1)

Vao Tsun
Vao Tsun

Reputation: 51629

log in to psql with password anr run "show hba_file;" the vi the pg_hba.conf file - change "local" section to trust for user foo...

or

just before running pgbouncer run export PGPASSWORD='whatever_password_is',

or

create a .pgpass file with saved password...

Upvotes: 2

Related Questions