Obtaining a full PostgreSQL database backup from a running instance

Obtaining a full PostgreSQL database backup from a running instance
Photo by Conny Schneider / Unsplash

When migrating existing Kubernetes installations of Mayan EDMS to an operator based installation, it is necessary to obtain a full backup first of the running installation.

kubectl exec -ti <pod name> /bin/bash

apt-get update && apt-get install postgresql-client bzip2

pg_dump -d mayan -h mayan-edms-testing.svc -U mayan -W | bzip2 > dump.sql.bz2

kubectl cp <pod name>:dump.sql.bz2 dump.sql.bz2