Charmed PostgreSQL K8s
- By Canonical Data Platform
- Databases
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/stable | 20 | 20 Sep 2022 | |
14/stable | 280 | 28 Jun 2024 | |
14/stable | 281 | 28 Jun 2024 | |
14/candidate | 281 | 18 Jun 2024 | |
14/candidate | 280 | 18 Jun 2024 | |
14/beta | 281 | 18 Jun 2024 | |
14/beta | 280 | 18 Jun 2024 | |
14/edge | 382 | 05 Sep 2024 | |
14/edge | 381 | 05 Sep 2024 |
juju deploy postgresql-k8s --channel 14/stable
Deploy Kubernetes operators easily with Juju, the Universal Operator Lifecycle Manager. Need a Kubernetes cluster? Install MicroK8s to create a full CNCF-certified Kubernetes system in under 60 seconds.
Platform:
Note: All commands are written for juju >= v.3.0
If you are using an earlier version, check the Juju 3.0 Release Notes.
How to migrate a cluster
This is a guide on how to restore a backup that was made from a different cluster, (i.e. cluster migration via restore).
To perform a basic restore (from a local backup), see How to restore a local backup
Prerequisites
Restoring a backup from a previous cluster to a current cluster requires:
- A single unit Charmed PostgreSQL deployed and running
- Access to S3 storage
- Configured settings for S3 storage
- Backups from the previous cluster in your S3 storage
- Passwords from your previous cluster
Manage cluster passwords
When you restore a backup from an old cluster, it will restore the password from the previous cluster to your current cluster. Set the password of your current cluster to the previous cluster’s password:
juju run postgresql-k8s/leader set-password username=operator password=<previous cluster password>
juju run postgresql-k8s/leader set-password username=replication password=<previous cluster password>
juju run postgresql-k8s/leader set-password username=rewind password=<previous cluster password>
List backups
To view the available backups to restore, use the command list-backups
:
juju run postgresql-k8s/leader list-backups
This shows a list of the available backups (it is up to you to identify which backup-id
corresponds to the previous-cluster):
backups:
|backup-id | backup-type | backup-status
----------------------------------------------------
YYYY-MM-DDTHH:MM:SSZ | physical | finished
Restore backup
To restore your current cluster to the state of the previous cluster, run the restore
command and pass the correct backup-id
to the command:
juju run postgresql-k8s/leader restore backup-id=YYYY-MM-DDTHH:MM:SSZ
Your restore will then be in progress. Once it is complete, your current cluster will represent the state of the previous cluster.