Skip to content

Latest commit

 

History

History
 
 

postgres

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

postgres namespace

Zalando postgres operator

Zalando operator to create highly available databases

Status of all clusters

kubectl get pods -o go-template='{{range .items}} kubectl -n {{.metadata.namespace}} exec {{.metadata.name}} -- patronictl list{{"\n"}}{{end}}' -A|grep postgres-0|bash -C

Repair HowTo

  • patroni manages the cluster
    • patronictl list - list member and status
    • patronictl reinit <cluster> <member> - reinit broken node
  • in-place upgrade: su postgres -c "python3 /scripts/inplace_upgrade.py 2"
  • cannot re-create DB cluster: kubectl delete poddisruptionbudgets postgres-<chart name>-zalando-postgres-cluster-postgres-pdb
  • apply backup:
    1. get into LEADER postgres node
    2. delete old DB:
      psql -U postgres -c 'drop database "tt-rss"'
      
    3. apt update && apt install -y openssh-client
    4. rsync anunez@nas:/volume1/kubernetes/backup/db/tt-rss/backup .
    5. psql -U postgres -f backup
  • list status of all clusters:
    • kubectl get pods -o go-template='{{range .items}} kubectl -n {{.metadata.namespace}} exec {{.metadata.name}} -- patronictl list{{"\n"}}{{end}}' -A|grep postgres-0|bash -C
  • reinit member of cluster:
    • kubectl exec -ti recipes-db-zalando-postgres-cluster-postgres-0 -- patronictl reinit