Skip to content

Replica/master/slave connect #932

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

Open
1999 opened this issue Feb 4, 2016 · 9 comments
Open

Replica/master/slave connect #932

1999 opened this issue Feb 4, 2016 · 9 comments

Comments

@1999
Copy link

1999 commented Feb 4, 2016

Hey,

We have a simple replicaset/master-slave configuration of Postgresql: 1 master and 2 slaves. Right now I can't see any option to connect to only master and make insert ops there. Or am I missing smth?

@akayami
Copy link

akayami commented Feb 18, 2016

This pg driver does not handle directly clusters as you described. You should create a little wrapper that will create a master pool and a pool for each of your slaves, and a functions to fetch a connections from master or slave.

@1999
Copy link
Author

1999 commented Feb 18, 2016

Is there any need of merging this functionality into pg?

@1999
Copy link
Author

1999 commented Mar 1, 2016

cc @brianc

@yocontra
Copy link
Contributor

yocontra commented Dec 8, 2016

@1999 Most database libraries support this kind of a setup, so I think it makes sense for this to be added.

@vsesh
Copy link

vsesh commented May 28, 2018

👍

@gajus
Copy link
Contributor

gajus commented Jun 26, 2018

I am running into a need to implement this as well.

I am going to write a higher level abstraction based on a principal that client.connect() and pool.connect() will be using writable master and queries made pool.query() will use read-only slave. I guess something along the lines of this + configuration could be added to node-postgress.

@tarunsinghh
Copy link

Any updates on this, how to achieve master and slave using node pg, or anyone who has written wrapper as suggested.

This is very basic usecase and it should be in pg itself.

@ozkan-meu
Copy link

Any updates ? Too many years past since the issue opened. JDBC supports this feature.

@brianc
Copy link
Owner

brianc commented Aug 6, 2024 via email

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

8 participants