zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.15k stars 950 forks source link

Create k8s Service pointing to synchronous replicas #2167

Open agrevtsev opened 1 year ago

agrevtsev commented 1 year ago

Hi team! The operator is creating foo-test-cluster-repl Service pointing to all replicas. When one wants to use synchronous replication, could the operator create the Service pointing only to synchronous replicas? E.g. foo-test-cluster-sync-repl pointing to replicas with Sync Standby role (patroni notation), foo-test-cluster-repl pointing to all replicas (it seems to me it's a valid case when total_replicas > sync_replicas).

Samusername commented 1 year ago

We have also seen cases where data needs to be read from synchronous replica / synchronous replicas. Reading from asynchronous replica was not ok (obsolete data was read).

"No stale reads": Synchronous replicas allow load balancing of consistent and up-to-date reads.

It would be great, if data could be written and read through same IP and port --> pgpool-ii?? ( I have not tested such a pgpool-ii setup. )