-
Notifications
You must be signed in to change notification settings - Fork 219
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
Automatic discovery of Primary and Replica nodes #228
Comments
I agree, I was thinking of implementing the same thing. Another approach could be to patch Patroni to update PgCat's config when something changes in the cluster. Generally I think config-driven routing is better than probing nodes for information because configs are changed and verified by some system who's entire job is to make sure configs are correct. Meanwhile, someone can just remove I think overall though, in most situations, this feature is likely to do more good than harm, so we should implement it but put it behind a config, e.g. |
hi, |
Yes, primary is a leader node with both reads and writes. Replica is for read only. |
Patroni definitely does a lot of great stuff; however, would it be within scope to just replace Patroni with something like this? The primary mechanism with pgcat seems to be a bit more narrow in scope. It doesn't appear as though the primary can be dynamically changed in this system, instead such would require a manual — or at least an externally driven — reconfig. Thoughts? |
At the moment, that's true, but we can make it dynamic. Patroni does more things to the actual DBs, like reconfiguration after failover, so pgcat can't replace Patroni yet, and might be out of scope at the moment. There is benefit to having a unified tool that handles Postgres production deployments as a whole, in the future. |
Got the same issue with pg-auto-failover |
Patroni uses confd for proxy config patching, https://github.com/zalando/patroni/tree/master/extras#confd |
I'm also using pg-auto-failover, so it would be great to make it easier to mark the new primary automatically, and then at least offer some notification capability. |
pg_autofailover here too |
Hi @levkk |
can someone found any solution for that issue? I'm getting same issue. |
This would be a great feature to have. We are not using Patroni but this feature would be perfect for our use case. |
Is your feature request related to a problem? Please describe.
When a primary node failover on PostgreSQL cluster specifically Patroni in my case, pgcat needs to be configured again to correctly route queries.
When this happens, it bans that node correctly, but it can not detect another node that becomes primary on its own. As a result of this, write queries get errors.
Describe the solution you'd like
I think this behaviour can be improved by checking nodes with a query like this to see if they are primary or replica.
If this query returns
true
pgcat can mark that node replica, if it'sfalse
then it knows that's a primary node.Describe alternatives you've considered
Another alternative can be creating a test table when pgcat starts, and it can run INSERT/DELETE/UPDATE on that table to see if it runs successfully.
What do you think? Is this a viable solution to this problem?
The text was updated successfully, but these errors were encountered: