0

What would be a valid example psql command for connecting to pgbouncer in case of valid auth_file:

"testuser" "SCRAM-SHA-256......blablaExample"

For the following conf:

auth_type=scram-sha-256
...
[databases]
targetdb = host=1.1.1.1 dbname=testdb port=5432 user=testuser password=testpw
alternativedb = host=2.2.2.2 dbname=testdb port=5432 user=testuser password=testpw
6
  • Your auth_type value is missing a hyphen. Commented Aug 29, 2023 at 20:55
  • @jjanes Sorry. That was a mistake on me writing the question. In reality I had it like I edited question now. Commented Aug 30, 2023 at 5:13
  • I figured out that the psql command I need is: psql -U testuser -d targetdb --host=1.1.1.1 --port=5432 But I haven't figured out why these SCRAM hash creation examples aren't working stackoverflow.com/questions/68400120/… Commented Aug 30, 2023 at 5:35
  • Can I use SCRAM to only authenticate connection to pgbouncer and login from pgbouncer to postgres server via password in [databases] list? Commented Aug 30, 2023 at 5:43
  • 1
    It only doesn't work in certain circumstances. I reported a bug. github.com/pgbouncer/pgbouncer/issues/944 Commented Sep 5, 2023 at 0:53

1 Answer 1

0
psql -U testuser -d targetdb --host=pgbouncerip --port=5432
psql -U testuser -d sourcedb --host=pgbouncerip --port=5432
Sign up to request clarification or add additional context in comments.

2 Comments

pgbouncer default port to listen is 6432, it is unclear from your config on which port you have configured pgboucer to listen. but since you have answered your own question i believe pgbouncer is listening on port 5432. port=5432 in your pgbouncer.ini signifies that your postgres is listening on 5432 as well. It's a good idea that you configure your database to listen on some other port that 5432 and then configure pgbouncer to listen on 5432 to avoid surprises
continued from my previous comment. if you have used default settings then the command should look like psql -U testuser -d sourcedb --host=pgbouncerip --port=6432

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.