Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to set multiple databases #67

Open
andkii opened this issue Aug 30, 2022 · 3 comments
Open

Add the ability to set multiple databases #67

andkii opened this issue Aug 30, 2022 · 3 comments

Comments

@andkii
Copy link

andkii commented Aug 30, 2022

It would be nice to be able to easily add multiple databases to a single pgbouncer configuration (for something like read-write splitting across master/slave instances).

Please correct me if I am wrong, but currently I believe this can only be done by supplying your own pgbouncer.ini

@PatrykKlimowicz
Copy link

PatrykKlimowicz commented Nov 18, 2022

@andkii could you share an example pgbouncer.ini that allows connection to multiple host with DBs?

@andkii
Copy link
Author

andkii commented Jan 17, 2023

@PatrykKlimowicz
You could have something like this in your pgbouncer.ini

[databases]
read_db = host=read.host.com port=5432
write_db = host=write.host.com port=55432

https://www.pgbouncer.org/config.html#section-databases

@shahradelahi
Copy link

Hi @andkii,

I recently completed a project that includes support for a particular feature that may be helpful to you. You can achieve having multiple databases by using this project.

docker run --rm \
    -e DB_READ="host=read.host.com port=5432 dbname=mydb password=secret auth_user=postgres" \
    -e DB_WRITE="host=write.host.com port=5432 dbname=mydb password=secret auth_user=postgres" \
    -e USER_POSTGRES="super-secret-password" \
    -p 6432:6432 \
    litehex/pgbouncer

I hope this helps you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants