BCDevOps / developer-experience

This repository is used to track all work for the BCGov Platform Services Team (This includes work for: 1. Platform Experience, 2. Developer Experience 3. Platform Operations/OCP 3)
Apache License 2.0
8 stars 17 forks source link

Debug: patroni issue for documize #72

Closed ShellyXueHan closed 4 years ago

ShellyXueHan commented 4 years ago

Background:

Fix:

Bring up another postgres v10 pod, copy over the data folder and spin up the db there. Then do pg_dump to obtain a proper copy.

Notes for next steps:

  1. could use the instance in test namespace to try it out first as it's having the same issue
  2. in prod namespace, pvc postgresql-documize-patroni-prod-2 contains the original copy of db, only remove when patroni is fully up and running with 2 replicas.
  3. current patroni documize-patroni-prod is brand new without any data, running only one replica (which is the master pod)
  4. refer to secret documize-patroni-prod in prod namespace for db connections.
  5. after pg_restore to the patroni pod, update statefulset config to have 2 replicas.
  6. if db is running properly, scale the app back to 2 pods
  7. if all running, scale patroni to 3 pods
WadeBarnes commented 4 years ago

@caggles, @ShellyXueHan , Some general thoughts on resizing or migrating PVCs, and backup (dump)/restore.

We have some automated tools to help with migrating data from one PVC to another of a different size and/or class that leaves the DCs unchanged in the end; BCDevOps/StorageMigration - MigrationSteps. I've used these tools to migrate data to larger PVCs and PVCs of different classes, for PostgreSQL and Jenkins containers. This should cover nearly all of your PVC resizing or migration needs.

For backup/restore of PostgreSQL (if that is really what is needed) I'd recommend using the BCDevOps/backup-container. At it's core (the PostgreSQL version) is a PostgreSQL v10 container, but the backup scripts provide you tested easy to use backup and restore functionality rather than fiddling with the raw pg_dump and psql backup/restore features directly.