pgBouncer – Managing Multiple Servers with Same Username but Different Passwords

authenticationpgbouncerpostgresql

I have an active pgBouncer setup with one PostgreSQL server.

We are planning to add one more PostgreSQL server to the same pgBouncer. But the problem is that both databases servers have the same username, but with different passwords.

Server1:

  • user: admin
  • password: admin123

Server2:

  • user: admin
  • password: admin@213

This feature is already requested here, can someone help me with any possible solutions?

Best Answer

There is a good workaround at the link in your question.

Another thing you can try is to use auth_user and auth_query with pgBouncer so that it fetches the password from the respective database. I am not sure if that works or if pgBouncer caches the password for each user.