vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on "Patroni" and DCS "etcd" or "consul"). Automating with Ansible.
MIT License
1.29k stars 352 forks source link

Feature: HA Proxy: Direct connection to Primary and/or Replica (apart from pgbouncer) #548

Closed jimnydev closed 4 months ago

jimnydev commented 4 months ago

Prior to submitting a PR and considering a deployment with pgbouncer: I was wondering if you would find it useful to expose Primary and Replica nodes directly (skipping pgbouncer) in HA Proxy config (using two new ports)?

Use case would be for applications that need to connect using replication protocol (which currently isn't supported by pgbouncer, and is unlikely to be supported for a while).

Thanks!

vitabaks commented 4 months ago

Just specify the variables when deploying the cluster:

with_haproxy_load_balancing: true

pgbouncer_install: false

In this case, the pgbouncer will not be installed, and connections via HAProxy will be routed directly to the database.

jimnydev commented 4 months ago

I would still like to have pgbouncer for connection pooling for other applications that are doing regular PostgreSQL protocol.

vitabaks commented 4 months ago

Now I understand that you are interested in the possibility of launching "selected" connections without the participation of a puller in a scenario using pgbouncer.

This feature will require further development. Feel free to suggest a PR.

jimnydev commented 4 months ago

Resolved via #549. Thank you!