zalando / postgres-operator

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

running more than 10 replicas #807

Closed eafzali closed 10 months ago

eafzali commented 4 years ago

Setting the numberOfInstances any number greater than 11 will cause following error on the operator:

ERROR: Failed to create physical replication slot '..._11'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/patroni/postgresql/__init__.py", line 236, in _query
    cursor.execute(sql, params)
psycopg2.errors.ConfigurationLimitExceeded: all replication slots are in use

HINT:  Free one or increase max_replication_slots.

and setting the max_replication_slots in postgres.parameters doesn't change the setting on the db, show max_replication_slots returns 10 regardless of what I've set in the manifest.

apiVersion: "acid.zalan.do/v1"
kind: postgresql
metadata:
  name: team1-db1
spec:
  teamId: "team1"
  volume:
    size: 10Gi
    storageClass: ssd
  numberOfInstances: 15
  users:
    user1:
    - superuser
    - createdb
  databases:
    db1: user1
  postgresql:
    version: "11"
    parameters: 
        shared_buffers: "2GB"
        temp_buffers: "512MB"
        work_mem: "8GB"
        max_connections: "200"
        random_page_cost: "1"
        max_replication_slots: "50"

How should I create more replicas?

Jan-M commented 4 years ago

I could ask "why" but fair point, increasing slot count should work.

eafzali commented 4 years ago

Sorry why what? why do I need more than 10 replicas?

Jan-M commented 4 years ago

Yeah exactly, but I also like this to be possible if it is needed as I am not aware of any limits. Maybe also worth looking into how to do cascading replication instead of single source.

eafzali commented 4 years ago

Yea cascading replication would be great, but for now I just need to know how to set max_replication_slots and max_wal_senders using the operator.

FxKu commented 4 years ago

should be with patronictl edit-config when execed into the master